· 6 years ago · Apr 03, 2019, 02:22 PM
1diff --git a/.clang-format b/.clang-format
2index a70897438..1d3d08687 100644
3--- a/.clang-format
4+++ b/.clang-format
5@@ -92,10 +92,6 @@ PenaltyBreakString: 1000
6 PenaltyExcessCharacter: 1000000
7 PenaltyReturnTypeOnItsOwnLine: 200
8 PointerAlignment: Right
9-RawStringFormats:
10- - Delimiter: pb
11- Language: TextProto
12- BasedOnStyle: Mozilla
13 ReflowComments: true
14 SortIncludes: false
15 SortUsingDeclarations: false
16diff --git a/contrib/openssl/async_engine.c b/contrib/openssl/async_engine.c
17index facffe0b4..6a1ce21b3 100644
18--- a/contrib/openssl/async_engine.c
19+++ b/contrib/openssl/async_engine.c
20@@ -39,174 +39,166 @@
21 #include <pthread.h>
22 #include <unistd.h>
23
24-
25 /* Engine Id and Name */
26-static const char *engine_id = "async-test";
27+static const char *engine_id = "async-test";
28 static const char *engine_name = "Asynchronous test engine";
29
30-
31 /* Engine Lifetime functions */
32 static int async_destroy(ENGINE *e);
33 static int engine_async_init(ENGINE *e);
34 static int async_finish(ENGINE *e);
35 void engine_load_async_int(void);
36
37-
38 static void async_pause_job(void);
39
40 /* RSA */
41
42-static int async_pub_enc(int flen, const unsigned char *from,
43- unsigned char *to, RSA *rsa, int padding);
44-static int async_pub_dec(int flen, const unsigned char *from,
45- unsigned char *to, RSA *rsa, int padding);
46-static int async_rsa_priv_enc(int flen, const unsigned char *from,
47- unsigned char *to, RSA *rsa, int padding);
48-static int async_rsa_priv_dec(int flen, const unsigned char *from,
49- unsigned char *to, RSA *rsa, int padding);
50-static int async_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
51- BN_CTX *ctx);
52+static int async_pub_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
53+static int async_pub_dec(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
54+static int async_rsa_priv_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
55+static int async_rsa_priv_dec(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
56+static int async_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx);
57
58 static int async_rsa_init(RSA *rsa);
59 static int async_rsa_finish(RSA *rsa);
60
61 static RSA_METHOD *async_rsa_method = NULL;
62
63-static int bind_async(ENGINE *e)
64+static int
65+bind_async(ENGINE *e)
66 {
67- /* Setup RSA_METHOD */
68- if ((async_rsa_method = RSA_meth_new("Async RSA method", 0)) == NULL
69- || RSA_meth_set_pub_enc(async_rsa_method, async_pub_enc) == 0
70- || RSA_meth_set_pub_dec(async_rsa_method, async_pub_dec) == 0
71- || RSA_meth_set_priv_enc(async_rsa_method, async_rsa_priv_enc) == 0
72- || RSA_meth_set_priv_dec(async_rsa_method, async_rsa_priv_dec) == 0
73- || RSA_meth_set_mod_exp(async_rsa_method, async_rsa_mod_exp) == 0
74- || RSA_meth_set_bn_mod_exp(async_rsa_method, BN_mod_exp_mont) == 0
75- || RSA_meth_set_init(async_rsa_method, async_rsa_init) == 0
76- || RSA_meth_set_finish(async_rsa_method, async_rsa_finish) == 0) {
77- fprintf(stderr, "Failed to initialize rsa method\n");
78- return 0;
79- }
80+ /* Setup RSA_METHOD */
81+ if ((async_rsa_method = RSA_meth_new("Async RSA method", 0)) == NULL ||
82+ RSA_meth_set_pub_enc(async_rsa_method, async_pub_enc) == 0 || RSA_meth_set_pub_dec(async_rsa_method, async_pub_dec) == 0 ||
83+ RSA_meth_set_priv_enc(async_rsa_method, async_rsa_priv_enc) == 0 ||
84+ RSA_meth_set_priv_dec(async_rsa_method, async_rsa_priv_dec) == 0 ||
85+ RSA_meth_set_mod_exp(async_rsa_method, async_rsa_mod_exp) == 0 ||
86+ RSA_meth_set_bn_mod_exp(async_rsa_method, BN_mod_exp_mont) == 0 || RSA_meth_set_init(async_rsa_method, async_rsa_init) == 0 ||
87+ RSA_meth_set_finish(async_rsa_method, async_rsa_finish) == 0) {
88+ fprintf(stderr, "Failed to initialize rsa method\n");
89+ return 0;
90+ }
91
92- /* Ensure the dasync error handling is set up */
93- ERR_load_ASYNC_strings();
94-
95- if (!ENGINE_set_id(e, engine_id)
96- || !ENGINE_set_name(e, engine_name)
97- || !ENGINE_set_RSA(e, async_rsa_method)
98- || !ENGINE_set_destroy_function(e, async_destroy)
99- || !ENGINE_set_init_function(e, engine_async_init)
100- || !ENGINE_set_finish_function(e, async_finish)) {
101- fprintf(stderr, "Failed to initialize\n");
102- return 0;
103- }
104+ /* Ensure the dasync error handling is set up */
105+ ERR_load_ASYNC_strings();
106+
107+ if (!ENGINE_set_id(e, engine_id) || !ENGINE_set_name(e, engine_name) || !ENGINE_set_RSA(e, async_rsa_method) ||
108+ !ENGINE_set_destroy_function(e, async_destroy) || !ENGINE_set_init_function(e, engine_async_init) ||
109+ !ENGINE_set_finish_function(e, async_finish)) {
110+ fprintf(stderr, "Failed to initialize\n");
111+ return 0;
112+ }
113
114- return 1;
115+ return 1;
116 }
117
118-# ifndef OPENSSL_NO_DYNAMIC_ENGINE
119-static int bind_helper(ENGINE *e, const char *id)
120+#ifndef OPENSSL_NO_DYNAMIC_ENGINE
121+static int
122+bind_helper(ENGINE *e, const char *id)
123 {
124- if (id && (strcmp(id, engine_id) != 0))
125- return 0;
126- if (!bind_async(e))
127- return 0;
128- return 1;
129+ if (id && (strcmp(id, engine_id) != 0))
130+ return 0;
131+ if (!bind_async(e))
132+ return 0;
133+ return 1;
134 }
135
136 IMPLEMENT_DYNAMIC_CHECK_FN()
137- IMPLEMENT_DYNAMIC_BIND_FN(bind_helper)
138-# endif
139+IMPLEMENT_DYNAMIC_BIND_FN(bind_helper)
140+#endif
141
142-static ENGINE *engine_async(void)
143+static ENGINE *
144+engine_async(void)
145 {
146- ENGINE *ret = ENGINE_new();
147- if (!ret)
148- return NULL;
149- if (!bind_async(ret)) {
150- ENGINE_free(ret);
151- return NULL;
152- }
153- return ret;
154+ ENGINE *ret = ENGINE_new();
155+ if (!ret)
156+ return NULL;
157+ if (!bind_async(ret)) {
158+ ENGINE_free(ret);
159+ return NULL;
160+ }
161+ return ret;
162 }
163
164-void engine_load_async_int(void)
165+void
166+engine_load_async_int(void)
167 {
168- ENGINE *toadd = engine_async();
169- if (!toadd)
170- return;
171- ENGINE_add(toadd);
172- ENGINE_free(toadd);
173- ERR_clear_error();
174+ ENGINE *toadd = engine_async();
175+ if (!toadd)
176+ return;
177+ ENGINE_add(toadd);
178+ ENGINE_free(toadd);
179+ ERR_clear_error();
180 }
181
182-static int engine_async_init(ENGINE *e)
183+static int
184+engine_async_init(ENGINE *e)
185 {
186- return 1;
187+ return 1;
188 }
189
190-
191-static int async_finish(ENGINE *e)
192+static int
193+async_finish(ENGINE *e)
194 {
195- return 1;
196+ return 1;
197 }
198
199-
200-static int async_destroy(ENGINE *e)
201+static int
202+async_destroy(ENGINE *e)
203 {
204- RSA_meth_free(async_rsa_method);
205- return 1;
206+ RSA_meth_free(async_rsa_method);
207+ return 1;
208 }
209
210-static void wait_cleanup(ASYNC_WAIT_CTX *ctx, const void *key,
211- OSSL_ASYNC_FD readfd, void *pvwritefd)
212+static void
213+wait_cleanup(ASYNC_WAIT_CTX *ctx, const void *key, OSSL_ASYNC_FD readfd, void *pvwritefd)
214 {
215- OSSL_ASYNC_FD *pwritefd = (OSSL_ASYNC_FD *)pvwritefd;
216- close(readfd);
217- close(*pwritefd);
218- OPENSSL_free(pwritefd);
219+ OSSL_ASYNC_FD *pwritefd = (OSSL_ASYNC_FD *)pvwritefd;
220+ close(readfd);
221+ close(*pwritefd);
222+ OPENSSL_free(pwritefd);
223 }
224
225 #define DUMMY_CHAR 'X'
226
227-static void async_pause_job(void) {
228- ASYNC_JOB *job;
229- ASYNC_WAIT_CTX *waitctx;
230- OSSL_ASYNC_FD pipefds[2] = {0, 0};
231- OSSL_ASYNC_FD *writefd;
232- char buf = DUMMY_CHAR;
233-
234- if ((job = ASYNC_get_current_job()) == NULL)
235- return;
236-
237- waitctx = ASYNC_get_wait_ctx(job);
238-
239- if (ASYNC_WAIT_CTX_get_fd(waitctx, engine_id, &pipefds[0],
240- (void **)&writefd)) {
241- pipefds[1] = *writefd;
242- } else {
243- writefd = (OSSL_ASYNC_FD *)OPENSSL_malloc(sizeof(*writefd));
244- if (writefd == NULL)
245- return;
246- if (pipe(pipefds) != 0) {
247- OPENSSL_free(writefd);
248- return;
249- }
250- *writefd = pipefds[1];
251-
252- if(!ASYNC_WAIT_CTX_set_wait_fd(waitctx, engine_id, pipefds[0],
253- writefd, wait_cleanup)) {
254- wait_cleanup(waitctx, engine_id, pipefds[0], writefd);
255- return;
256- }
257+static void
258+async_pause_job(void)
259+{
260+ ASYNC_JOB *job;
261+ ASYNC_WAIT_CTX *waitctx;
262+ OSSL_ASYNC_FD pipefds[2] = {0, 0};
263+ OSSL_ASYNC_FD *writefd;
264+ char buf = DUMMY_CHAR;
265+
266+ if ((job = ASYNC_get_current_job()) == NULL)
267+ return;
268+
269+ waitctx = ASYNC_get_wait_ctx(job);
270+
271+ if (ASYNC_WAIT_CTX_get_fd(waitctx, engine_id, &pipefds[0], (void **)&writefd)) {
272+ pipefds[1] = *writefd;
273+ } else {
274+ writefd = (OSSL_ASYNC_FD *)OPENSSL_malloc(sizeof(*writefd));
275+ if (writefd == NULL)
276+ return;
277+ if (pipe(pipefds) != 0) {
278+ OPENSSL_free(writefd);
279+ return;
280 }
281+ *writefd = pipefds[1];
282
283- /* Ignore errors - we carry on anyway */
284- ASYNC_pause_job();
285+ if (!ASYNC_WAIT_CTX_set_wait_fd(waitctx, engine_id, pipefds[0], writefd, wait_cleanup)) {
286+ wait_cleanup(waitctx, engine_id, pipefds[0], writefd);
287+ return;
288+ }
289+ }
290
291- /* Clear the wake signal */
292- if (read(pipefds[0], &buf, 1) < 0)
293- return;
294+ /* Ignore errors - we carry on anyway */
295+ ASYNC_pause_job();
296+
297+ /* Clear the wake signal */
298+ if (read(pipefds[0], &buf, 1) < 0)
299+ return;
300 }
301
302 void *
303@@ -218,7 +210,6 @@ delay_method(void *arg)
304 write(signal_fd, &buf, sizeof(buf));
305 }
306
307-
308 void
309 spawn_delay_thread()
310 {
311@@ -227,15 +218,15 @@ spawn_delay_thread()
312 OSSL_ASYNC_FD pipefds[2] = {0, 0};
313 ASYNC_JOB *job;
314 if ((job = ASYNC_get_current_job()) == NULL)
315- return;
316+ return;
317
318 ASYNC_WAIT_CTX *waitctx = ASYNC_get_wait_ctx(job);
319
320 size_t numfds;
321 if (ASYNC_WAIT_CTX_get_all_fds(waitctx, &signal_fd, &numfds) && numfds > 0) {
322 } else {
323- OSSL_ASYNC_FD pipefds[2] = {0,0};
324- OSSL_ASYNC_FD *writefd = OPENSSL_malloc(sizeof(*writefd));
325+ OSSL_ASYNC_FD pipefds[2] = {0, 0};
326+ OSSL_ASYNC_FD *writefd = OPENSSL_malloc(sizeof(*writefd));
327 pipe(pipefds);
328 signal_fd = *writefd = pipefds[1];
329 ASYNC_WAIT_CTX_set_wait_fd(waitctx, engine_id, pipefds[0], writefd, wait_cleanup);
330@@ -244,54 +235,53 @@ spawn_delay_thread()
331 pthread_create(&thread_id, NULL, delay_method, (void *)((intptr_t)signal_fd));
332 }
333
334-
335 /*
336 * RSA implementation
337 */
338
339-static int async_pub_enc(int flen, const unsigned char *from,
340- unsigned char *to, RSA *rsa, int padding) {
341- return RSA_meth_get_pub_enc(RSA_PKCS1_OpenSSL())
342- (flen, from, to, rsa, padding);
343+static int
344+async_pub_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
345+{
346+ return RSA_meth_get_pub_enc(RSA_PKCS1_OpenSSL())(flen, from, to, rsa, padding);
347 }
348
349-static int async_pub_dec(int flen, const unsigned char *from,
350- unsigned char *to, RSA *rsa, int padding) {
351- return RSA_meth_get_pub_dec(RSA_PKCS1_OpenSSL())
352- (flen, from, to, rsa, padding);
353+static int
354+async_pub_dec(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
355+{
356+ return RSA_meth_get_pub_dec(RSA_PKCS1_OpenSSL())(flen, from, to, rsa, padding);
357 }
358
359-static int async_rsa_priv_enc(int flen, const unsigned char *from,
360- unsigned char *to, RSA *rsa, int padding)
361+static int
362+async_rsa_priv_enc(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
363 {
364- //printf("async_priv_enc\n");
365- spawn_delay_thread();
366- async_pause_job();
367- return RSA_meth_get_priv_enc(RSA_PKCS1_OpenSSL())
368- (flen, from, to, rsa, padding);
369+ // printf("async_priv_enc\n");
370+ spawn_delay_thread();
371+ async_pause_job();
372+ return RSA_meth_get_priv_enc(RSA_PKCS1_OpenSSL())(flen, from, to, rsa, padding);
373 }
374
375-static int async_rsa_priv_dec(int flen, const unsigned char *from,
376- unsigned char *to, RSA *rsa, int padding)
377+static int
378+async_rsa_priv_dec(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
379 {
380- //printf("async_priv_dec\n");
381- spawn_delay_thread();
382- async_pause_job();
383- return RSA_meth_get_priv_dec(RSA_PKCS1_OpenSSL())
384- (flen, from, to, rsa, padding);
385+ // printf("async_priv_dec\n");
386+ spawn_delay_thread();
387+ async_pause_job();
388+ return RSA_meth_get_priv_dec(RSA_PKCS1_OpenSSL())(flen, from, to, rsa, padding);
389 }
390
391-static int async_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
392+static int
393+async_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
394 {
395- return RSA_meth_get_mod_exp(RSA_PKCS1_OpenSSL())(r0, I, rsa, ctx);
396+ return RSA_meth_get_mod_exp(RSA_PKCS1_OpenSSL())(r0, I, rsa, ctx);
397 }
398
399-static int async_rsa_init(RSA *rsa)
400+static int
401+async_rsa_init(RSA *rsa)
402 {
403- return RSA_meth_get_init(RSA_PKCS1_OpenSSL())(rsa);
404+ return RSA_meth_get_init(RSA_PKCS1_OpenSSL())(rsa);
405 }
406-static int async_rsa_finish(RSA *rsa)
407+static int
408+async_rsa_finish(RSA *rsa)
409 {
410- return RSA_meth_get_finish(RSA_PKCS1_OpenSSL())(rsa);
411+ return RSA_meth_get_finish(RSA_PKCS1_OpenSSL())(rsa);
412 }
413-
414diff --git a/example/cache_scan/cache_scan.cc b/example/cache_scan/cache_scan.cc
415index f889fb880..7a545afe4 100644
416--- a/example/cache_scan/cache_scan.cc
417+++ b/example/cache_scan/cache_scan.cc
418@@ -493,7 +493,7 @@ cache_print_plugin(TSCont contp, TSEvent event, void *edata)
419
420 //----------------------------------------------------------------------------
421 void
422-TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
423+TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */[])
424 {
425 TSPluginRegistrationInfo info;
426
427diff --git a/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc b/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
428index 1389e9c27..622e1e1a7 100644
429--- a/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
430+++ b/example/cppapi/async_http_fetch_streaming/AsyncHttpFetchStreaming.cc
431@@ -77,7 +77,7 @@ public:
432 };
433
434 void
435-TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
436+TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */[])
437 {
438 if (!RegisterGlobalPlugin("CPP_Example_AsyncHttpFetchStreaming", "apache", "dev@trafficserver.apache.org")) {
439 return;
440diff --git a/example/cppapi/intercept/intercept.cc b/example/cppapi/intercept/intercept.cc
441index ec3c747ea..e66be30d6 100644
442--- a/example/cppapi/intercept/intercept.cc
443+++ b/example/cppapi/intercept/intercept.cc
444@@ -58,7 +58,7 @@ public:
445 };
446
447 void
448-TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
449+TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */[])
450 {
451 if (!RegisterGlobalPlugin("CPP_Example_Intercept", "apache", "dev@trafficserver.apache.org")) {
452 return;
453diff --git a/example/intercept/intercept.cc b/example/intercept/intercept.cc
454index c793e19b9..602857ed0 100644
455--- a/example/intercept/intercept.cc
456+++ b/example/intercept/intercept.cc
457@@ -534,7 +534,7 @@ InterceptTxnHook(TSCont contp, TSEvent event, void *edata)
458 }
459
460 void
461-TSPluginInit(int /* argc */, const char * /* argv */ [])
462+TSPluginInit(int /* argc */, const char * /* argv */[])
463 {
464 TSPluginRegistrationInfo info;
465
466diff --git a/example/passthru/passthru.cc b/example/passthru/passthru.cc
467index 587f35a0c..b8e47d813 100644
468--- a/example/passthru/passthru.cc
469+++ b/example/passthru/passthru.cc
470@@ -315,7 +315,7 @@ PassthruListen()
471 }
472
473 void
474-TSPluginInit(int /* argc */, const char * /* argv */ [])
475+TSPluginInit(int /* argc */, const char * /* argv */[])
476 {
477 TSPluginRegistrationInfo info = {PLUGIN_NAME, "Apache Software Foundation", "dev@trafficserver.apache.org"};
478
479diff --git a/example/statistic/statistic.cc b/example/statistic/statistic.cc
480index 09ee0477b..f76f736a9 100644
481--- a/example/statistic/statistic.cc
482+++ b/example/statistic/statistic.cc
483@@ -36,7 +36,7 @@
484 #define PLUGIN_NAME "statistics"
485
486 void
487-TSPluginInit(int /* argc */, const char * /* argv */ [])
488+TSPluginInit(int /* argc */, const char * /* argv */[])
489 {
490 TSPluginRegistrationInfo info;
491
492diff --git a/iocore/cache/CacheTest.cc b/iocore/cache/CacheTest.cc
493index 8231ac735..22fbe4647 100644
494--- a/iocore/cache/CacheTest.cc
495+++ b/iocore/cache/CacheTest.cc
496@@ -333,13 +333,14 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */,
497 remove_fail_test.expect_event = CACHE_EVENT_REMOVE_FAILED;
498 rand_CacheKey(&remove_fail_test.key, thread->mutex);
499
500- CACHE_SM(t, replace_write_test,
501- { cacheProcessor.open_write(this, &key, CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_SYNC); } int open_write_callout() {
502- header.serial = 10;
503- cache_vc->set_header(&header, sizeof(header));
504- cvio = cache_vc->do_io_write(this, nbytes, buffer_reader);
505- return 1;
506- });
507+ CACHE_SM(
508+ t, replace_write_test,
509+ { cacheProcessor.open_write(this, &key, CACHE_FRAG_TYPE_NONE, 100, CACHE_WRITE_OPT_SYNC); } int open_write_callout() {
510+ header.serial = 10;
511+ cache_vc->set_header(&header, sizeof(header));
512+ cvio = cache_vc->do_io_write(this, nbytes, buffer_reader);
513+ return 1;
514+ });
515 replace_write_test.expect_initial_event = CACHE_EVENT_OPEN_WRITE;
516 replace_write_test.expect_event = VC_EVENT_WRITE_COMPLETE;
517 replace_write_test.nbytes = 100;
518@@ -365,16 +366,17 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */,
519 replace_test.key = replace_write_test.key;
520 replace_test.content_salt = 1;
521
522- CACHE_SM(t, replace_read_test, { cacheProcessor.open_read(this, &key); } int open_read_callout() {
523- CacheTestHeader *h = nullptr;
524- int hlen = 0;
525- if (cache_vc->get_header((void **)&h, &hlen) < 0)
526- return -1;
527- if (h->serial != 11)
528- return -1;
529- cvio = cache_vc->do_io_read(this, nbytes, buffer);
530- return 1;
531- });
532+ CACHE_SM(
533+ t, replace_read_test, { cacheProcessor.open_read(this, &key); } int open_read_callout() {
534+ CacheTestHeader *h = nullptr;
535+ int hlen = 0;
536+ if (cache_vc->get_header((void **)&h, &hlen) < 0)
537+ return -1;
538+ if (h->serial != 11)
539+ return -1;
540+ cvio = cache_vc->do_io_read(this, nbytes, buffer);
541+ return 1;
542+ });
543 replace_read_test.expect_initial_event = CACHE_EVENT_OPEN_READ;
544 replace_read_test.expect_event = VC_EVENT_READ_COMPLETE;
545 replace_read_test.nbytes = 100;
546@@ -387,10 +389,11 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */,
547 large_write_test.nbytes = 10000000;
548 rand_CacheKey(&large_write_test.key, thread->mutex);
549
550- CACHE_SM(t, pread_test, { cacheProcessor.open_read(this, &key); } int open_read_callout() {
551- cvio = cache_vc->do_io_pread(this, nbytes, buffer, 7000000);
552- return 1;
553- });
554+ CACHE_SM(
555+ t, pread_test, { cacheProcessor.open_read(this, &key); } int open_read_callout() {
556+ cvio = cache_vc->do_io_pread(this, nbytes, buffer, 7000000);
557+ return 1;
558+ });
559 pread_test.expect_initial_event = CACHE_EVENT_OPEN_READ;
560 pread_test.expect_event = VC_EVENT_READ_COMPLETE;
561 pread_test.nbytes = 100;
562diff --git a/iocore/eventsystem/test_Buffer.cc b/iocore/eventsystem/test_Buffer.cc
563index ccef10368..1badce26c 100644
564--- a/iocore/eventsystem/test_Buffer.cc
565+++ b/iocore/eventsystem/test_Buffer.cc
566@@ -31,7 +31,7 @@
567 #define TEST_THREADS 2
568
569 int
570-main(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
571+main(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */[])
572 {
573 RecModeT mode_type = RECM_STAND_ALONE;
574
575diff --git a/iocore/eventsystem/test_Event.cc b/iocore/eventsystem/test_Event.cc
576index 714aff534..b7ee183a3 100644
577--- a/iocore/eventsystem/test_Event.cc
578+++ b/iocore/eventsystem/test_Event.cc
579@@ -59,7 +59,7 @@ struct process_killer : public Continuation {
580 };
581
582 int
583-main(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
584+main(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */[])
585 {
586 RecModeT mode_type = RECM_STAND_ALONE;
587 count = 0;
588diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
589index 68dd6fa4f..92ff540fc 100644
590--- a/lib/records/RecCore.cc
591+++ b/lib/records/RecCore.cc
592@@ -1281,11 +1281,12 @@ RecSignalWarning(int sig, const char *fmt, ...)
593 void
594 RecConfigWarnIfUnregistered()
595 {
596- RecDumpRecords(RECT_CONFIG,
597- [](RecT, void *, int registered_p, const char *name, int, RecData *) -> void {
598- if (!registered_p) {
599- Warning("Unrecognized configuration value '%s'", name);
600- }
601- },
602- nullptr);
603+ RecDumpRecords(
604+ RECT_CONFIG,
605+ [](RecT, void *, int registered_p, const char *name, int, RecData *) -> void {
606+ if (!registered_p) {
607+ Warning("Unrecognized configuration value '%s'", name);
608+ }
609+ },
610+ nullptr);
611 }
612diff --git a/lib/tsconfig/Errata.cc b/lib/tsconfig/Errata.cc
613index f91ca7f7e..ba85add46 100644
614--- a/lib/tsconfig/Errata.cc
615+++ b/lib/tsconfig/Errata.cc
616@@ -20,86 +20,88 @@
617 limitations under the License.
618 */
619
620-# include "Errata.h"
621-# include <iostream>
622-# include <sstream>
623-# include <iomanip>
624-# include <algorithm>
625-# include <memory.h>
626-
627-namespace ts {
628-
629+#include "Errata.h"
630+#include <iostream>
631+#include <sstream>
632+#include <iomanip>
633+#include <algorithm>
634+#include <memory.h>
635+
636+namespace ts
637+{
638 /** List of sinks for abandoned erratum.
639 */
640-namespace {
641+namespace
642+{
643 std::deque<Errata::Sink::Handle> Sink_List;
644 }
645
646 std::string const Errata::DEFAULT_GLUE("\n");
647 Errata::Message const Errata::NIL_MESSAGE;
648-Errata::Code Errata::Message::Default_Code = 0;
649-Errata::Message::SuccessTest const Errata::Message::DEFAULT_SUCCESS_TEST =
650- &Errata::Message::isCodeZero;
651-Errata::Message::SuccessTest Errata::Message::Success_Test =
652- Errata::Message::DEFAULT_SUCCESS_TEST;
653+Errata::Code Errata::Message::Default_Code = 0;
654+Errata::Message::SuccessTest const Errata::Message::DEFAULT_SUCCESS_TEST = &Errata::Message::isCodeZero;
655+Errata::Message::SuccessTest Errata::Message::Success_Test = Errata::Message::DEFAULT_SUCCESS_TEST;
656
657 bool
658-Errata::Message::isCodeZero(Message const& msg) {
659+Errata::Message::isCodeZero(Message const &msg)
660+{
661 return msg.m_code == 0;
662 }
663
664 void
665-Errata::Data::push(Message const& msg) {
666+Errata::Data::push(Message const &msg)
667+{
668 m_items.push_back(msg);
669 }
670
671 void
672-Errata::Data::push(Message && msg) {
673+Errata::Data::push(Message &&msg)
674+{
675 m_items.push_back(std::move(msg));
676 }
677
678-Errata::Message const&
679-Errata::Data::top() const {
680- return m_items.size() ? m_items.back() : NIL_MESSAGE ;
681+Errata::Message const &
682+Errata::Data::top() const
683+{
684+ return m_items.size() ? m_items.back() : NIL_MESSAGE;
685 }
686
687-inline Errata::Errata(ImpPtr const& ptr)
688- : m_data(ptr) {
689-}
690+inline Errata::Errata(ImpPtr const &ptr) : m_data(ptr) {}
691
692-Errata::Data::~Data() {
693+Errata::Data::~Data()
694+{
695 if (m_log_on_delete) {
696 Errata tmp(ImpPtr(this)); // because client API requires a wrapper.
697- for ( auto& f : Sink_List ) { (*f)(tmp); }
698+ for (auto &f : Sink_List) {
699+ (*f)(tmp);
700+ }
701 tmp.m_data.release(); // don't delete this again.
702 }
703 }
704
705-Errata::Errata(self const& that)
706- : m_data(that.m_data) {
707-}
708+Errata::Errata(self const &that) : m_data(that.m_data) {}
709
710-Errata::Errata(self && that)
711- : m_data(that.m_data) {
712-}
713+Errata::Errata(self &&that) : m_data(that.m_data) {}
714
715-Errata::Errata(std::string const& text) {
716+Errata::Errata(std::string const &text)
717+{
718 this->push(text);
719 }
720
721-Errata::Errata(Id id, std::string const& text) {
722+Errata::Errata(Id id, std::string const &text)
723+{
724 this->push(id, text);
725 }
726
727-Errata::~Errata() {
728-}
729+Errata::~Errata() {}
730
731 /* This forces the errata to have a data object that only it references.
732 If we're sharing the data, clone. If there's no data, allocate.
733 This is used just before a write operation to have copy on write semantics.
734 */
735-Errata::Data*
736-Errata::pre_write() {
737+Errata::Data *
738+Errata::pre_write()
739+{
740 if (m_data) {
741 if (m_data.use_count() > 1) {
742 m_data.reset(new Data(*m_data)); // clone current data
743@@ -111,33 +113,39 @@ Errata::pre_write() {
744 }
745
746 // Just create an instance if needed.
747-Errata::Data const*
748-Errata::instance() {
749- if (!m_data) { m_data.reset(new Data);
750-}
751+Errata::Data const *
752+Errata::instance()
753+{
754+ if (!m_data) {
755+ m_data.reset(new Data);
756+ }
757 return m_data.get();
758 }
759
760-Errata&
761-Errata::push(Message const& msg) {
762+Errata &
763+Errata::push(Message const &msg)
764+{
765 this->pre_write()->push(msg);
766 return *this;
767 }
768
769-Errata&
770-Errata::push(Message && msg) {
771+Errata &
772+Errata::push(Message &&msg)
773+{
774 this->pre_write()->push(std::move(msg));
775 return *this;
776 }
777
778-Errata&
779-Errata::operator=(self const& that) {
780+Errata &
781+Errata::operator=(self const &that)
782+{
783 m_data = that.m_data;
784 return *this;
785 }
786
787-Errata&
788-Errata::operator = (Message const& msg) {
789+Errata &
790+Errata::operator=(Message const &msg)
791+{
792 // Avoid copy on write in the case where we discard.
793 if (!m_data || m_data.use_count() > 1) {
794 this->clear();
795@@ -149,28 +157,27 @@ Errata::operator = (Message const& msg) {
796 return *this;
797 }
798
799-Errata&
800-Errata::operator = (self && that) {
801+Errata &
802+Errata::operator=(self &&that)
803+{
804 m_data = that.m_data;
805 return *this;
806 }
807
808-Errata&
809-Errata::pull(self& that) {
810+Errata &
811+Errata::pull(self &that)
812+{
813 if (that.m_data) {
814 this->pre_write();
815- m_data->m_items.insert(
816- m_data->m_items.end(),
817- that.m_data->m_items.begin(),
818- that.m_data->m_items.end()
819- );
820+ m_data->m_items.insert(m_data->m_items.end(), that.m_data->m_items.begin(), that.m_data->m_items.end());
821 that.m_data->m_items.clear();
822 }
823 return *this;
824 }
825
826 void
827-Errata::pop() {
828+Errata::pop()
829+{
830 if (m_data && m_data->size()) {
831 this->pre_write()->m_items.pop_front();
832 }
833@@ -178,7 +185,8 @@ Errata::pop() {
834 }
835
836 void
837-Errata::clear() {
838+Errata::clear()
839+{
840 m_data.reset(nullptr);
841 }
842
843@@ -195,67 +203,54 @@ Errata::clear() {
844 static Errata::Container NIL_CONTAINER;
845
846 Errata::iterator
847-Errata::begin() {
848+Errata::begin()
849+{
850 return m_data ? m_data->m_items.rbegin() : NIL_CONTAINER.rbegin();
851 }
852
853 Errata::const_iterator
854-Errata::begin() const {
855- return m_data ? static_cast<Data const&>(*m_data).m_items.rbegin()
856- : static_cast<Container const&>(NIL_CONTAINER).rbegin();
857+Errata::begin() const
858+{
859+ return m_data ? static_cast<Data const &>(*m_data).m_items.rbegin() : static_cast<Container const &>(NIL_CONTAINER).rbegin();
860 }
861
862 Errata::iterator
863-Errata::end() {
864+Errata::end()
865+{
866 return m_data ? m_data->m_items.rend() : NIL_CONTAINER.rend();
867 }
868
869 Errata::const_iterator
870-Errata::end() const {
871- return m_data ? static_cast<Data const&>(*m_data).m_items.rend()
872- : static_cast<Container const&>(NIL_CONTAINER).rend();
873+Errata::end() const
874+{
875+ return m_data ? static_cast<Data const &>(*m_data).m_items.rend() : static_cast<Container const &>(NIL_CONTAINER).rend();
876 }
877
878 void
879-Errata::registerSink(Sink::Handle const& s) {
880+Errata::registerSink(Sink::Handle const &s)
881+{
882 Sink_List.push_back(s);
883 }
884
885-std::ostream&
886-Errata::write(
887- std::ostream& out,
888- int offset,
889- int indent,
890- int shift,
891- char const* lead
892-) const {
893-
894- for ( auto m : *this ) {
895+std::ostream &
896+Errata::write(std::ostream &out, int offset, int indent, int shift, char const *lead) const
897+{
898+ for (auto m : *this) {
899 if ((offset + indent) > 0) {
900- out << std::setw(indent + offset) << std::setfill(' ')
901- << ((indent > 0 && lead) ? lead : " ");
902+ out << std::setw(indent + offset) << std::setfill(' ') << ((indent > 0 && lead) ? lead : " ");
903 }
904
905- out << m.m_id << " [" << m.m_code << "]: " << m.m_text
906- << std::endl
907- ;
908+ out << m.m_id << " [" << m.m_code << "]: " << m.m_text << std::endl;
909 if (m.getErrata().size()) {
910- m.getErrata().write(out, offset, indent+shift, shift, lead);
911-}
912-
913+ m.getErrata().write(out, offset, indent + shift, shift, lead);
914+ }
915 }
916 return out;
917 }
918
919 size_t
920-Errata::write(
921- char *buff,
922- size_t n,
923- int offset,
924- int indent,
925- int shift,
926- char const* lead
927-) const {
928+Errata::write(char *buff, size_t n, int offset, int indent, int shift, char const *lead) const
929+{
930 std::ostringstream out;
931 std::string text;
932 this->write(out, offset, indent, shift, lead);
933@@ -264,7 +259,9 @@ Errata::write(
934 return text.size();
935 }
936
937-std::ostream& operator<< (std::ostream& os, Errata const& err) {
938+std::ostream &
939+operator<<(std::ostream &os, Errata const &err)
940+{
941 return err.write(os, 0, 0, 2, "> ");
942 }
943
944diff --git a/lib/tsconfig/Errata.h b/lib/tsconfig/Errata.h
945index eba5bacf4..1cbbd0ca5 100644
946--- a/lib/tsconfig/Errata.h
947+++ b/lib/tsconfig/Errata.h
948@@ -1,5 +1,5 @@
949-# if !defined TS_ERRATA_HEADER
950-# define TS_ERRATA_HEADER
951+#if !defined TS_ERRATA_HEADER
952+#define TS_ERRATA_HEADER
953
954 /** @file
955 Stacking error message handling.
956@@ -65,312 +65,310 @@
957 limitations under the License.
958 */
959
960-# include <memory>
961-# include <string>
962-# include <iosfwd>
963-# include <sstream>
964-# include <deque>
965-# include "NumericType.h"
966-# include "IntrusivePtr.h"
967-
968-namespace ts {
969+#include <memory>
970+#include <string>
971+#include <iosfwd>
972+#include <sstream>
973+#include <deque>
974+#include "NumericType.h"
975+#include "IntrusivePtr.h"
976
977+namespace ts
978+{
979 /** Class to hold a stack of error messages (the "errata").
980 This is a smart handle class, which wraps the actual data
981 and can therefore be treated a value type with cheap copy
982 semantics. Default construction is very cheap.
983 */
984-class Errata {
985+class Errata
986+{
987 protected:
988- /// Implementation class.
989- struct Data;
990- /// Handle for implementation class instance.
991- typedef IntrusivePtr<Data> ImpPtr;
992+ /// Implementation class.
993+ struct Data;
994+ /// Handle for implementation class instance.
995+ typedef IntrusivePtr<Data> ImpPtr;
996+
997 public:
998- typedef Errata self; /// Self reference type.
999-
1000- /// Message ID.
1001- typedef NumericType<unsigned int, struct MsgIdTag> Id;
1002-
1003- /* Tag / level / code severity.
1004- This is intended for clients to use to provide additional
1005- classification of a message. A severity code, as for syslog,
1006- is a common use.
1007-
1008- */
1009- typedef NumericType<unsigned int, struct CodeTag> Code;
1010- struct Message;
1011-
1012- typedef std::deque<Message> Container; ///< Storage type for messages.
1013- // We iterate backwards to look like a stack.
1014-// typedef Container::reverse_iterator iterator; ///< Message iteration.
1015- /// Message const iteration.
1016-// typedef Container::const_reverse_iterator const_iterator;
1017- /// Reverse message iteration.
1018-// typedef Container::iterator reverse_iterator;
1019- /// Reverse constant message iteration.
1020-// typedef Container::const_iterator const_reverse_iterator;
1021-
1022- /// Default constructor - empty errata, very fast.
1023- Errata();
1024- /// Copy constructor, very fast.
1025- Errata (
1026- self const& that ///< Object to copy
1027- );
1028- /// Construct from string.
1029- /// Message Id and Code are default.
1030- explicit Errata(
1031- std::string const& text ///< Finalized message text.
1032- );
1033- /// Construct with @a id and @a text.
1034- /// Code is default.
1035- Errata(
1036- Id id, ///< Message id.
1037- std::string const& text ///< Message text.
1038- );
1039- /// Construct with @a id, @a code, and @a text.
1040- Errata(
1041- Id id, ///< Message text.
1042- Code code, ///< Message code.
1043- std::string const& text ///< Message text.
1044- );
1045- /** Construct from a message instance.
1046- This is equivalent to default constructing an @c errata and then
1047- invoking @c push with an argument of @a msg.
1048- */
1049- Errata(
1050- Message const& msg ///< Message to push
1051- );
1052-
1053- /// Move constructor.
1054- Errata(self && that);
1055- /// Move constructor from @c Message.
1056- Errata(Message && msg);
1057-
1058- /// destructor
1059- ~Errata();
1060-
1061- /// Self assignment.
1062- /// @return A reference to this object.
1063- self& operator = (
1064- const self& that ///< Source instance.
1065- );
1066-
1067- /// Move assignment.
1068- self& operator = (self && that);
1069-
1070- /** Assign message.
1071- All other messages are discarded.
1072- @return A reference to this object.
1073- */
1074- self& operator = (
1075- Message const& msg ///< Source message.
1076- );
1077-
1078- /** Push @a text as a message.
1079- The message is constructed from just the @a text.
1080- It becomes the top message.
1081- @return A reference to this object.
1082- */
1083- self& push(std::string const& text);
1084- /** Push @a text as a message with message @a id.
1085- The message is constructed from @a text and @a id.
1086- It becomes the top message.
1087- @return A reference to this object.
1088- */
1089- self& push(Id id, std::string const& text);
1090- /** Push @a text as a message with message @a id and @a code.
1091- The message is constructed from @a text and @a id.
1092- It becomes the top message.
1093- @return A reference to this object.
1094- */
1095- self& push(Id id, Code code, std::string const& text);
1096- /** Push a message.
1097- @a msg becomes the top message.
1098- @return A reference to this object.
1099- */
1100- self& push(Message const& msg);
1101- self& push(Message && msg);
1102-
1103- /** Push a constructed @c Message.
1104- The @c Message is set to have the @a id and @a code. The other arguments are converted
1105- to strings and concatenated to form the messsage text.
1106- @return A reference to this object.
1107- */
1108- template < typename ... Args >
1109- self& push(Id id, Code code, Args const& ... args);
1110-
1111- /** Push a nested status.
1112- @a err becomes the top item.
1113- @return A reference to this object.
1114- */
1115- self& push(self const& err);
1116-
1117- /** Access top message.
1118- @return If the errata is empty, a default constructed message
1119- otherwise the most recent message.
1120- */
1121- Message const& top() const;
1122-
1123- /** Move messages from @a that to @c this errata.
1124- Messages from @a that are put on the top of the
1125- stack in @c this and removed from @a that.
1126- */
1127- self& pull(self& that);
1128-
1129- /// Remove last message.
1130- void pop();
1131-
1132- /// Remove all messages.
1133- void clear();
1134-
1135- /** Inhibit logging.
1136- @note This only affects @c this as a top level @c errata.
1137- It has no effect on this @c this being logged as a nested
1138- @c errata.
1139- */
1140- self& doNotLog();
1141-
1142- friend std::ostream& operator<< (std::ostream&, self const&);
1143-
1144- /// Default glue value (a newline) for text rendering.
1145- static std::string const DEFAULT_GLUE;
1146-
1147- /** Test status.
1148-
1149- Equivalent to @c success but more convenient for use in
1150- control statements.
1151-
1152- @return @c true if no messages or last message has a zero
1153- message ID, @c false otherwise.
1154- */
1155- operator bool() const;
1156-
1157- /** Test errata for no failure condition.
1158-
1159- Equivalent to @c operator @c bool but easier to invoke.
1160-
1161- @return @c true if no messages or last message has a zero
1162- message ID, @c false otherwise.
1163- */
1164- bool isOK() const;
1165-
1166- /// Number of messages in the errata.
1167- size_t size() const;
1168-
1169- /* Forward declares.
1170- We have to make our own iterators as the least bad option. The problem
1171- is that we have recursive structures so declaration order is difficult.
1172- We can't use the container iterators here because the element type is
1173- not yet defined. If we define the element type here, it can't contain
1174- an Errata and we have to do funky things to get around that. So we
1175- have our own iterators, which are just shadowing sublclasses of the
1176- container iterators.
1177- */
1178- class iterator;
1179- class const_iterator;
1180-
1181- /// Reference to top item on the stack.
1182- iterator begin();
1183- /// Reference to top item on the stack.
1184- const_iterator begin() const;
1185- //! Reference one past bottom item on the stack.
1186- iterator end();
1187- //! Reference one past bottom item on the stack.
1188- const_iterator end() const;
1189-
1190- // Logging support.
1191-
1192- /** Base class for erratum sink.
1193- When an errata is abandoned, this will be called on it to perform
1194- any client specific logging. It is passed around by handle so that
1195- it doesn't have to support copy semantics (and is not destructed
1196- until application shutdown). Clients can subclass this class in order
1197- to preserve arbitrary data for the sink or retain a handle to the
1198- sink for runtime modifications.
1199- */
1200- class Sink : public IntrusivePtrCounter {
1201- public:
1202- typedef Sink self; ///< Self reference type.
1203- typedef IntrusivePtr<self> Handle; ///< Handle type.
1204-
1205- /// Handle an abandoned errata.
1206- virtual void operator() (Errata const&) const = 0;
1207- /// Force virtual destructor.
1208- virtual ~Sink() {}
1209- };
1210-
1211- //! Register a sink for discarded erratum.
1212- static void registerSink(Sink::Handle const& s);
1213-
1214- /// Register a function as a sink.
1215- typedef void (*SinkHandlerFunction)(Errata const&);
1216-
1217- // Wrapper class to support registering functions as sinks.
1218- struct SinkFunctionWrapper : public Sink {
1219- /// Constructor.
1220- SinkFunctionWrapper(SinkHandlerFunction f) : m_f(f) { }
1221- /// Operator to invoke the function.
1222- void operator() (Errata const& e) const override { m_f(e); }
1223- SinkHandlerFunction m_f; ///< Client supplied handler.
1224- };
1225-
1226- /// Register a sink function for abandonded erratum.
1227- static void registerSink(SinkHandlerFunction f) {
1228- registerSink(Sink::Handle(new SinkFunctionWrapper(f)));
1229- }
1230+ typedef Errata self; /// Self reference type.
1231
1232- /** Simple formatted output.
1233-
1234- Each message is written to a line. All lines are indented with
1235- whitespace @a offset characters. Lines are indented an
1236- additional @a indent. This value is increased by @a shift for
1237- each level of nesting of an @c Errata. if @a lead is not @c
1238- NULL the indentation is overwritten by @a lead if @a indent is
1239- non-zero. It acts as a "continuation" marker for nested
1240- @c Errata.
1241-
1242- */
1243- std::ostream& write(
1244- std::ostream& out, ///< Output stream.
1245- int offset, ///< Lead white space for every line.
1246- int indent, ///< Additional indention per line for messages.
1247- int shift, ///< Additional @a indent for nested @c Errata.
1248- char const* lead ///< Leading text for nested @c Errata.
1249- ) const;
1250- /// Simple formatted output to fixed sized buffer.
1251- /// @return Number of characters written to @a buffer.
1252- size_t write(
1253- char* buffer, ///< Output buffer.
1254- size_t n, ///< Buffer size.
1255- int offset, ///< Lead white space for every line.
1256- int indent, ///< Additional indention per line for messages.
1257- int shift, ///< Additional @a indent for nested @c Errata.
1258- char const* lead ///< Leading text for nested @c Errata.
1259- ) const;
1260+ /// Message ID.
1261+ typedef NumericType<unsigned int, struct MsgIdTag> Id;
1262
1263-protected:
1264- /// Construct from implementation pointer.
1265- /// Used internally by nested classes.
1266- Errata(ImpPtr const& ptr);
1267- /// Implementation instance.
1268- ImpPtr m_data;
1269+ /* Tag / level / code severity.
1270+ This is intended for clients to use to provide additional
1271+ classification of a message. A severity code, as for syslog,
1272+ is a common use.
1273+
1274+ */
1275+ typedef NumericType<unsigned int, struct CodeTag> Code;
1276+ struct Message;
1277+
1278+ typedef std::deque<Message> Container; ///< Storage type for messages.
1279+ // We iterate backwards to look like a stack.
1280+ // typedef Container::reverse_iterator iterator; ///< Message iteration.
1281+ /// Message const iteration.
1282+ // typedef Container::const_reverse_iterator const_iterator;
1283+ /// Reverse message iteration.
1284+ // typedef Container::iterator reverse_iterator;
1285+ /// Reverse constant message iteration.
1286+ // typedef Container::const_iterator const_reverse_iterator;
1287+
1288+ /// Default constructor - empty errata, very fast.
1289+ Errata();
1290+ /// Copy constructor, very fast.
1291+ Errata(self const &that ///< Object to copy
1292+ );
1293+ /// Construct from string.
1294+ /// Message Id and Code are default.
1295+ explicit Errata(std::string const &text ///< Finalized message text.
1296+ );
1297+ /// Construct with @a id and @a text.
1298+ /// Code is default.
1299+ Errata(Id id, ///< Message id.
1300+ std::string const &text ///< Message text.
1301+ );
1302+ /// Construct with @a id, @a code, and @a text.
1303+ Errata(Id id, ///< Message text.
1304+ Code code, ///< Message code.
1305+ std::string const &text ///< Message text.
1306+ );
1307+ /** Construct from a message instance.
1308+ This is equivalent to default constructing an @c errata and then
1309+ invoking @c push with an argument of @a msg.
1310+ */
1311+ Errata(Message const &msg ///< Message to push
1312+ );
1313+
1314+ /// Move constructor.
1315+ Errata(self &&that);
1316+ /// Move constructor from @c Message.
1317+ Errata(Message &&msg);
1318+
1319+ /// destructor
1320+ ~Errata();
1321
1322- /// Return the implementation instance, allocating and unsharing as needed.
1323- Data* pre_write();
1324- /// Force and return an implementation instance.
1325- /// Does not follow copy on write.
1326- Data const* instance();
1327+ /// Self assignment.
1328+ /// @return A reference to this object.
1329+ self &operator=(const self &that ///< Source instance.
1330+ );
1331+
1332+ /// Move assignment.
1333+ self &operator=(self &&that);
1334+
1335+ /** Assign message.
1336+ All other messages are discarded.
1337+ @return A reference to this object.
1338+ */
1339+ self &operator=(Message const &msg ///< Source message.
1340+ );
1341
1342- /// Used for returns when no data is present.
1343- static Message const NIL_MESSAGE;
1344+ /** Push @a text as a message.
1345+ The message is constructed from just the @a text.
1346+ It becomes the top message.
1347+ @return A reference to this object.
1348+ */
1349+ self &push(std::string const &text);
1350+ /** Push @a text as a message with message @a id.
1351+ The message is constructed from @a text and @a id.
1352+ It becomes the top message.
1353+ @return A reference to this object.
1354+ */
1355+ self &push(Id id, std::string const &text);
1356+ /** Push @a text as a message with message @a id and @a code.
1357+ The message is constructed from @a text and @a id.
1358+ It becomes the top message.
1359+ @return A reference to this object.
1360+ */
1361+ self &push(Id id, Code code, std::string const &text);
1362+ /** Push a message.
1363+ @a msg becomes the top message.
1364+ @return A reference to this object.
1365+ */
1366+ self &push(Message const &msg);
1367+ self &push(Message &&msg);
1368
1369- friend struct Data;
1370- friend class Item;
1371+ /** Push a constructed @c Message.
1372+ The @c Message is set to have the @a id and @a code. The other arguments are converted
1373+ to strings and concatenated to form the messsage text.
1374+ @return A reference to this object.
1375+ */
1376+ template <typename... Args> self &push(Id id, Code code, Args const &... args);
1377+
1378+ /** Push a nested status.
1379+ @a err becomes the top item.
1380+ @return A reference to this object.
1381+ */
1382+ self &push(self const &err);
1383+
1384+ /** Access top message.
1385+ @return If the errata is empty, a default constructed message
1386+ otherwise the most recent message.
1387+ */
1388+ Message const &top() const;
1389+
1390+ /** Move messages from @a that to @c this errata.
1391+ Messages from @a that are put on the top of the
1392+ stack in @c this and removed from @a that.
1393+ */
1394+ self &pull(self &that);
1395+
1396+ /// Remove last message.
1397+ void pop();
1398+
1399+ /// Remove all messages.
1400+ void clear();
1401
1402+ /** Inhibit logging.
1403+ @note This only affects @c this as a top level @c errata.
1404+ It has no effect on this @c this being logged as a nested
1405+ @c errata.
1406+ */
1407+ self &doNotLog();
1408+
1409+ friend std::ostream &operator<<(std::ostream &, self const &);
1410+
1411+ /// Default glue value (a newline) for text rendering.
1412+ static std::string const DEFAULT_GLUE;
1413+
1414+ /** Test status.
1415+
1416+ Equivalent to @c success but more convenient for use in
1417+ control statements.
1418+
1419+ @return @c true if no messages or last message has a zero
1420+ message ID, @c false otherwise.
1421+ */
1422+ operator bool() const;
1423+
1424+ /** Test errata for no failure condition.
1425+
1426+ Equivalent to @c operator @c bool but easier to invoke.
1427+
1428+ @return @c true if no messages or last message has a zero
1429+ message ID, @c false otherwise.
1430+ */
1431+ bool isOK() const;
1432+
1433+ /// Number of messages in the errata.
1434+ size_t size() const;
1435+
1436+ /* Forward declares.
1437+ We have to make our own iterators as the least bad option. The problem
1438+ is that we have recursive structures so declaration order is difficult.
1439+ We can't use the container iterators here because the element type is
1440+ not yet defined. If we define the element type here, it can't contain
1441+ an Errata and we have to do funky things to get around that. So we
1442+ have our own iterators, which are just shadowing sublclasses of the
1443+ container iterators.
1444+ */
1445+ class iterator;
1446+ class const_iterator;
1447+
1448+ /// Reference to top item on the stack.
1449+ iterator begin();
1450+ /// Reference to top item on the stack.
1451+ const_iterator begin() const;
1452+ //! Reference one past bottom item on the stack.
1453+ iterator end();
1454+ //! Reference one past bottom item on the stack.
1455+ const_iterator end() const;
1456+
1457+ // Logging support.
1458+
1459+ /** Base class for erratum sink.
1460+ When an errata is abandoned, this will be called on it to perform
1461+ any client specific logging. It is passed around by handle so that
1462+ it doesn't have to support copy semantics (and is not destructed
1463+ until application shutdown). Clients can subclass this class in order
1464+ to preserve arbitrary data for the sink or retain a handle to the
1465+ sink for runtime modifications.
1466+ */
1467+ class Sink : public IntrusivePtrCounter
1468+ {
1469+ public:
1470+ typedef Sink self; ///< Self reference type.
1471+ typedef IntrusivePtr<self> Handle; ///< Handle type.
1472+
1473+ /// Handle an abandoned errata.
1474+ virtual void operator()(Errata const &) const = 0;
1475+ /// Force virtual destructor.
1476+ virtual ~Sink() {}
1477+ };
1478+
1479+ //! Register a sink for discarded erratum.
1480+ static void registerSink(Sink::Handle const &s);
1481+
1482+ /// Register a function as a sink.
1483+ typedef void (*SinkHandlerFunction)(Errata const &);
1484+
1485+ // Wrapper class to support registering functions as sinks.
1486+ struct SinkFunctionWrapper : public Sink {
1487+ /// Constructor.
1488+ SinkFunctionWrapper(SinkHandlerFunction f) : m_f(f) {}
1489+ /// Operator to invoke the function.
1490+ void
1491+ operator()(Errata const &e) const override
1492+ {
1493+ m_f(e);
1494+ }
1495+ SinkHandlerFunction m_f; ///< Client supplied handler.
1496+ };
1497+
1498+ /// Register a sink function for abandonded erratum.
1499+ static void
1500+ registerSink(SinkHandlerFunction f)
1501+ {
1502+ registerSink(Sink::Handle(new SinkFunctionWrapper(f)));
1503+ }
1504+
1505+ /** Simple formatted output.
1506+
1507+ Each message is written to a line. All lines are indented with
1508+ whitespace @a offset characters. Lines are indented an
1509+ additional @a indent. This value is increased by @a shift for
1510+ each level of nesting of an @c Errata. if @a lead is not @c
1511+ NULL the indentation is overwritten by @a lead if @a indent is
1512+ non-zero. It acts as a "continuation" marker for nested
1513+ @c Errata.
1514+
1515+ */
1516+ std::ostream &write(std::ostream &out, ///< Output stream.
1517+ int offset, ///< Lead white space for every line.
1518+ int indent, ///< Additional indention per line for messages.
1519+ int shift, ///< Additional @a indent for nested @c Errata.
1520+ char const *lead ///< Leading text for nested @c Errata.
1521+ ) const;
1522+ /// Simple formatted output to fixed sized buffer.
1523+ /// @return Number of characters written to @a buffer.
1524+ size_t write(char *buffer, ///< Output buffer.
1525+ size_t n, ///< Buffer size.
1526+ int offset, ///< Lead white space for every line.
1527+ int indent, ///< Additional indention per line for messages.
1528+ int shift, ///< Additional @a indent for nested @c Errata.
1529+ char const *lead ///< Leading text for nested @c Errata.
1530+ ) const;
1531+
1532+protected:
1533+ /// Construct from implementation pointer.
1534+ /// Used internally by nested classes.
1535+ Errata(ImpPtr const &ptr);
1536+ /// Implementation instance.
1537+ ImpPtr m_data;
1538+
1539+ /// Return the implementation instance, allocating and unsharing as needed.
1540+ Data *pre_write();
1541+ /// Force and return an implementation instance.
1542+ /// Does not follow copy on write.
1543+ Data const *instance();
1544+
1545+ /// Used for returns when no data is present.
1546+ static Message const NIL_MESSAGE;
1547+
1548+ friend struct Data;
1549+ friend class Item;
1550 };
1551
1552-extern std::ostream& operator<< (std::ostream& os, Errata const& stat);
1553+extern std::ostream &operator<<(std::ostream &os, Errata const &stat);
1554
1555 /// Storage for a single message.
1556 struct Errata::Message {
1557@@ -382,64 +380,54 @@ struct Errata::Message {
1558
1559 /// Construct from text.
1560 /// Id is zero and Code is default.
1561- Message(
1562- std::string const& text ///< Finalized message text.
1563+ Message(std::string const &text ///< Finalized message text.
1564 );
1565
1566 /// Construct with @a id and @a text.
1567 /// Code is default.
1568- Message(
1569- Id id, ///< ID of message in table.
1570- std::string const& text ///< Final text for message.
1571+ Message(Id id, ///< ID of message in table.
1572+ std::string const &text ///< Final text for message.
1573 );
1574
1575 /// Construct with @a id, @a code, and @a text.
1576- Message(
1577- Id id, ///< Message Id.
1578- Code code, ///< Message Code.
1579- std::string const& text ///< Final text for message.
1580+ Message(Id id, ///< Message Id.
1581+ Code code, ///< Message Code.
1582+ std::string const &text ///< Final text for message.
1583 );
1584
1585 /// Construct with an @a id, @a code, and a @a message.
1586 /// The message contents are created by converting the variable arguments
1587 /// to strings using the stream operator and concatenated in order.
1588- template < typename ... Args>
1589- Message(
1590- Id id, ///< Message Id.
1591- Code code, ///< Message Code.
1592- Args const& ... text
1593- );
1594+ template <typename... Args>
1595+ Message(Id id, ///< Message Id.
1596+ Code code, ///< Message Code.
1597+ Args const &... text);
1598
1599 /// Reset to the message to default state.
1600- self& clear();
1601+ self &clear();
1602
1603 /// Set the message Id.
1604- self& set(
1605- Id id ///< New message Id.
1606+ self &set(Id id ///< New message Id.
1607 );
1608
1609 /// Set the code.
1610- self& set(
1611- Code code ///< New code for message.
1612+ self &set(Code code ///< New code for message.
1613 );
1614
1615 /// Set the text.
1616- self& set(
1617- std::string const& text ///< New message text.
1618+ self &set(std::string const &text ///< New message text.
1619 );
1620
1621 /// Set the text.
1622- self& set(
1623- char const* text ///< New message text.
1624+ self &set(char const *text ///< New message text.
1625 );
1626
1627 /// Set the errata.
1628- self& set(
1629- Errata const& err ///< Errata to store.
1630+ self &set(Errata const &err ///< Errata to store.
1631 );
1632
1633 /// Get the text of the message.
1634- std::string const& text() const;
1635+ std::string const &text() const;
1636
1637 /// Get the code.
1638 Code getCode() const;
1639@@ -457,7 +445,7 @@ struct Errata::Message {
1640 static Code Default_Code;
1641
1642 /// Type for overriding success message test.
1643- typedef bool (*SuccessTest)(Message const& m);
1644+ typedef bool (*SuccessTest)(Message const &m);
1645
1646 /** Success message test.
1647
1648@@ -476,16 +464,16 @@ struct Errata::Message {
1649
1650 /// Indicate success if the message code is zero.
1651 /// @note Used as the default success test.
1652- static bool isCodeZero(Message const& m);
1653+ static bool isCodeZero(Message const &m);
1654
1655 static SuccessTest const DEFAULT_SUCCESS_TEST;
1656
1657- template < typename ... Args> static std::string stringify(Args const& ... items);
1658+ template <typename... Args> static std::string stringify(Args const &... items);
1659
1660- Id m_id; ///< Message ID.
1661- Code m_code; ///< Message code.
1662+ Id m_id; ///< Message ID.
1663+ Code m_code; ///< Message code.
1664 std::string m_text; ///< Final text.
1665- Errata m_errata; ///< Nested errata.
1666+ Errata m_errata; ///< Nested errata.
1667 };
1668
1669 /** This is the implementation class for Errata.
1670@@ -510,11 +498,11 @@ struct Errata::Data : public IntrusivePtrCounter {
1671 size_t size() const;
1672
1673 /// Get the top message on the stack.
1674- Message const& top() const;
1675+ Message const &top() const;
1676
1677 /// Put a message on top of the stack.
1678- void push(Message const& msg);
1679- void push(Message && msg);
1680+ void push(Message const &msg);
1681+ void push(Message &&msg);
1682
1683 /// Log this when it is deleted.
1684 mutable bool m_log_on_delete = true;
1685@@ -524,50 +512,48 @@ struct Errata::Data : public IntrusivePtrCounter {
1686 };
1687
1688 /// Forward iterator for @c Messages in an @c Errata.
1689-class Errata::iterator : public Errata::Container::reverse_iterator {
1690+class Errata::iterator : public Errata::Container::reverse_iterator
1691+{
1692 public:
1693- typedef iterator self; ///< Self reference type.
1694- typedef Errata::Container::reverse_iterator super; ///< Parent type.
1695- iterator(); ///< Default constructor.
1696- /// Copy constructor.
1697- iterator(
1698- self const& that ///< Source instance.
1699- );
1700- /// Construct from super class.
1701- iterator(
1702- super const& that ///< Source instance.
1703- );
1704- /// Assignment.
1705- self& operator = (self const& that);
1706- /// Assignment from super class.
1707- self& operator = (super const& that);
1708- /// Prefix increment.
1709- self& operator ++ ();
1710- /// Prefix decrement.
1711- self& operator -- ();
1712+ typedef iterator self; ///< Self reference type.
1713+ typedef Errata::Container::reverse_iterator super; ///< Parent type.
1714+ iterator(); ///< Default constructor.
1715+ /// Copy constructor.
1716+ iterator(self const &that ///< Source instance.
1717+ );
1718+ /// Construct from super class.
1719+ iterator(super const &that ///< Source instance.
1720+ );
1721+ /// Assignment.
1722+ self &operator=(self const &that);
1723+ /// Assignment from super class.
1724+ self &operator=(super const &that);
1725+ /// Prefix increment.
1726+ self &operator++();
1727+ /// Prefix decrement.
1728+ self &operator--();
1729 };
1730
1731 /// Forward constant iterator for @c Messages in an @c Errata.
1732-class Errata::const_iterator : public Errata::Container::const_reverse_iterator {
1733+class Errata::const_iterator : public Errata::Container::const_reverse_iterator
1734+{
1735 public:
1736- typedef const_iterator self; ///< Self reference type.
1737- typedef Errata::Container::const_reverse_iterator super; ///< Parent type.
1738- const_iterator(); ///< Default constructor.
1739- /// Copy constructor.
1740- const_iterator(
1741- self const& that ///< Source instance.
1742- );
1743- const_iterator(
1744- super const& that ///< Source instance.
1745- );
1746- /// Assignment.
1747- self& operator = (self const& that);
1748- /// Assignment from super class.
1749- self& operator = (super const& that);
1750- /// Prefix increment.
1751- self& operator ++ ();
1752- /// Prefix decrement.
1753- self& operator -- ();
1754+ typedef const_iterator self; ///< Self reference type.
1755+ typedef Errata::Container::const_reverse_iterator super; ///< Parent type.
1756+ const_iterator(); ///< Default constructor.
1757+ /// Copy constructor.
1758+ const_iterator(self const &that ///< Source instance.
1759+ );
1760+ const_iterator(super const &that ///< Source instance.
1761+ );
1762+ /// Assignment.
1763+ self &operator=(self const &that);
1764+ /// Assignment from super class.
1765+ self &operator=(super const &that);
1766+ /// Prefix increment.
1767+ self &operator++();
1768+ /// Prefix decrement.
1769+ self &operator--();
1770 };
1771
1772 /** Helper class for @c Rv.
1773@@ -575,15 +561,14 @@ public:
1774 and members out of the header file for a cleaner API.
1775 */
1776 struct RvBase {
1777- Errata _errata; ///< The status from the function.
1778+ Errata _errata; ///< The status from the function.
1779
1780 /** Default constructor. */
1781 RvBase();
1782
1783 /** Construct with specific status.
1784 */
1785- RvBase (
1786- Errata const& s ///< Status to copy
1787+ RvBase(Errata const &s ///< Status to copy
1788 );
1789
1790 //! Test the return value for success.
1791@@ -608,13 +593,12 @@ struct RvBase {
1792 to @a R for ease of use and compatibility so clients can upgrade
1793 asynchronously.
1794 */
1795-template < typename R >
1796-struct Rv : public RvBase {
1797- typedef Rv self; ///< Standard self reference type.
1798+template <typename R> struct Rv : public RvBase {
1799+ typedef Rv self; ///< Standard self reference type.
1800 typedef RvBase super; ///< Standard super class reference type.
1801- typedef R Result; ///< Type of result value.
1802+ typedef R Result; ///< Type of result value.
1803
1804- Result _result; ///< The actual result of the function.
1805+ Result _result; ///< The actual result of the function.
1806
1807 /** Default constructor.
1808 The default constructor for @a R is used.
1809@@ -629,8 +613,7 @@ struct Rv : public RvBase {
1810 @note Not @c explicit so that clients can return just a result
1811 and have it be marked as SUCCESS.
1812 */
1813- Rv(
1814- Result const& r ///< The function result
1815+ Rv(Result const &r ///< The function result
1816 );
1817
1818 /** Construct from a result and a pre-existing status object.
1819@@ -638,9 +621,8 @@ struct Rv : public RvBase {
1820 @internal No constructor from just an Errata to avoid
1821 potential ambiguity with constructing from result type.
1822 */
1823- Rv(
1824- Result const& r, ///< The function result
1825- Errata const& s ///< A pre-existing status object
1826+ Rv(Result const &r, ///< The function result
1827+ Errata const &s ///< A pre-existing status object
1828 );
1829
1830 /** User conversion to the result type.
1831@@ -649,7 +631,7 @@ struct Rv : public RvBase {
1832 result only to other functions without having to extract it by
1833 hand.
1834 */
1835- operator Result const& () const;
1836+ operator Result const &() const;
1837
1838 /** Assignment from result type.
1839
1840@@ -671,9 +653,10 @@ struct Rv : public RvBase {
1841
1842 @return A reference to the copy of @a r stored in this object.
1843 */
1844- Result& operator = (
1845- Result const& r ///< Result to assign
1846- ) {
1847+ Result &
1848+ operator=(Result const &r ///< Result to assign
1849+ )
1850+ {
1851 _result = r;
1852 return _result;
1853 }
1854@@ -681,9 +664,8 @@ struct Rv : public RvBase {
1855 /** Add the status from another instance to this one.
1856 @return A reference to @c this object.
1857 */
1858- template < typename U >
1859- self& push(
1860- Rv<U> const& that ///< Source of status messages
1861+ template <typename U>
1862+ self &push(Rv<U> const &that ///< Source of status messages
1863 );
1864
1865 /** Set the result.
1866@@ -700,228 +682,338 @@ struct Rv : public RvBase {
1867 return zret.set(value);
1868 @endcode
1869 */
1870- self& set(
1871- Result const& r ///< Result to store
1872+ self &set(Result const &r ///< Result to store
1873 );
1874
1875 /** Return the result.
1876 @return A reference to the result value in this object.
1877 */
1878- Result& result();
1879+ Result &result();
1880
1881 /** Return the result.
1882 @return A reference to the result value in this object.
1883 */
1884- Result const& result() const;
1885+ Result const &result() const;
1886
1887 /** Return the status.
1888 @return A reference to the @c errata in this object.
1889 */
1890- Errata& errata();
1891+ Errata &errata();
1892
1893 /** Return the status.
1894 @return A reference to the @c errata in this object.
1895 */
1896- Errata const& errata() const;
1897+ Errata const &errata() const;
1898
1899 /// Directly set the errata
1900- self& operator = (
1901- Errata const& status ///< Errata to assign.
1902+ self &operator=(Errata const &status ///< Errata to assign.
1903 );
1904
1905 /// Push a message on to the status.
1906- self& push(
1907- Errata::Message const& msg
1908- );
1909+ self &push(Errata::Message const &msg);
1910 };
1911
1912 /** Combine a function result and status in to an @c Rv.
1913 This is useful for clients that want to declare the status object
1914 and result independently.
1915 */
1916-template < typename R > Rv<R>
1917-MakeRv(
1918- R const& r, ///< The function result
1919- Errata const& s ///< The pre-existing status object
1920-) {
1921- return Rv<R>(r, s);
1922+template <typename R>
1923+Rv<R>
1924+MakeRv(R const &r, ///< The function result
1925+ Errata const &s ///< The pre-existing status object
1926+)
1927+{
1928+ return Rv<R>(r, s);
1929 }
1930 /* ----------------------------------------------------------------------- */
1931 /* ----------------------------------------------------------------------- */
1932 // Inline methods.
1933-inline Errata::Message::Message()
1934- : m_id(0), m_code(Default_Code) {
1935-}
1936-inline Errata::Message::Message(std::string const& text)
1937- : m_id(0), m_code(Default_Code), m_text(text) {
1938-}
1939-inline Errata::Message::Message(Id id, std::string const& text)
1940- : m_id(id), m_code(Default_Code), m_text(text) {
1941-}
1942-inline Errata::Message::Message(Id id, Code code, std::string const& text)
1943- : m_id(id), m_code(code), m_text(text) {
1944-}
1945-template < typename ... Args>
1946-Errata::Message::Message(Id id, Code code, Args const& ... text)
1947- : m_id(id), m_code(code), m_text(stringify(text ...))
1948+inline Errata::Message::Message() : m_id(0), m_code(Default_Code) {}
1949+inline Errata::Message::Message(std::string const &text) : m_id(0), m_code(Default_Code), m_text(text) {}
1950+inline Errata::Message::Message(Id id, std::string const &text) : m_id(id), m_code(Default_Code), m_text(text) {}
1951+inline Errata::Message::Message(Id id, Code code, std::string const &text) : m_id(id), m_code(code), m_text(text) {}
1952+template <typename... Args>
1953+Errata::Message::Message(Id id, Code code, Args const &... text) : m_id(id), m_code(code), m_text(stringify(text...))
1954 {
1955 }
1956
1957-inline Errata::Message& Errata::Message::clear() {
1958- m_id = 0;
1959+inline Errata::Message &
1960+Errata::Message::clear()
1961+{
1962+ m_id = 0;
1963 m_code = Default_Code;
1964 m_text.erase();
1965 m_errata.clear();
1966 return *this;
1967 }
1968
1969-inline std::string const& Errata::Message::text() const { return m_text; }
1970-inline Errata::Code Errata::Message::getCode() const { return m_code; }
1971-inline Errata Errata::Message::getErrata() const { return m_errata; }
1972+inline std::string const &
1973+Errata::Message::text() const
1974+{
1975+ return m_text;
1976+}
1977+inline Errata::Code
1978+Errata::Message::getCode() const
1979+{
1980+ return m_code;
1981+}
1982+inline Errata
1983+Errata::Message::getErrata() const
1984+{
1985+ return m_errata;
1986+}
1987
1988-inline Errata::Message& Errata::Message::set(Id id) {
1989+inline Errata::Message &
1990+Errata::Message::set(Id id)
1991+{
1992 m_id = id;
1993 return *this;
1994 }
1995-inline Errata::Message& Errata::Message::set(Code code) {
1996+inline Errata::Message &
1997+Errata::Message::set(Code code)
1998+{
1999 m_code = code;
2000 return *this;
2001 }
2002-inline Errata::Message& Errata::Message::set(std::string const& text) {
2003+inline Errata::Message &
2004+Errata::Message::set(std::string const &text)
2005+{
2006 m_text = text;
2007 return *this;
2008 }
2009-inline Errata::Message& Errata::Message::set(char const* text) {
2010+inline Errata::Message &
2011+Errata::Message::set(char const *text)
2012+{
2013 m_text = text;
2014 return *this;
2015 }
2016-inline Errata::Message& Errata::Message::set(Errata const& err) {
2017+inline Errata::Message &
2018+Errata::Message::set(Errata const &err)
2019+{
2020 m_errata = err;
2021 m_errata.doNotLog();
2022 return *this;
2023 }
2024
2025-template < typename ... Args>
2026-std::string Errata::Message::stringify(Args const& ... items)
2027+template <typename... Args>
2028+std::string
2029+Errata::Message::stringify(Args const &... items)
2030 {
2031 std::ostringstream s;
2032- (void)(int[]){0, ( (s << items) , 0 ) ... };
2033+ (void)(int[]){0, ((s << items), 0)...};
2034 return s.str();
2035 }
2036
2037 inline Errata::Errata() {}
2038-inline Errata::Errata(Id id, Code code, std::string const& text) {
2039+inline Errata::Errata(Id id, Code code, std::string const &text)
2040+{
2041 this->push(Message(id, code, text));
2042 }
2043-inline Errata::Errata(Message const& msg) {
2044+inline Errata::Errata(Message const &msg)
2045+{
2046 this->push(msg);
2047 }
2048-inline Errata::Errata(Message && msg) {
2049+inline Errata::Errata(Message &&msg)
2050+{
2051 this->push(std::move(msg));
2052 }
2053
2054-inline Errata::operator bool() const { return this->isOK(); }
2055+inline Errata::operator bool() const
2056+{
2057+ return this->isOK();
2058+}
2059
2060-inline size_t Errata::size() const {
2061+inline size_t
2062+Errata::size() const
2063+{
2064 return m_data ? m_data->m_items.size() : 0;
2065 }
2066
2067-inline bool Errata::isOK() const {
2068- return nullptr == m_data
2069- || 0 == m_data->size()
2070- || Message::Success_Test(this->top())
2071- ;
2072+inline bool
2073+Errata::isOK() const
2074+{
2075+ return nullptr == m_data || 0 == m_data->size() || Message::Success_Test(this->top());
2076 }
2077
2078-inline Errata&
2079-Errata::push(std::string const& text) {
2080+inline Errata &
2081+Errata::push(std::string const &text)
2082+{
2083 this->push(Message(text));
2084 return *this;
2085 }
2086
2087-inline Errata&
2088-Errata::push(Id id, std::string const& text) {
2089+inline Errata &
2090+Errata::push(Id id, std::string const &text)
2091+{
2092 this->push(Message(id, text));
2093 return *this;
2094 }
2095
2096-inline Errata&
2097-Errata::push(Id id, Code code, std::string const& text) {
2098+inline Errata &
2099+Errata::push(Id id, Code code, std::string const &text)
2100+{
2101 this->push(Message(id, code, text));
2102 return *this;
2103 }
2104
2105-template < typename ... Args >
2106-auto Errata::push(Id id, Code code, Args const& ... args) -> self&
2107+template <typename... Args>
2108+auto
2109+Errata::push(Id id, Code code, Args const &... args) -> self &
2110 {
2111- this->push(Message(id, code, args ...));
2112+ this->push(Message(id, code, args...));
2113 return *this;
2114 }
2115
2116-inline Errata::Message const&
2117-Errata::top() const {
2118+inline Errata::Message const &
2119+Errata::top() const
2120+{
2121 return m_data ? m_data->top() : NIL_MESSAGE;
2122 }
2123-inline Errata& Errata::doNotLog() {
2124+inline Errata &
2125+Errata::doNotLog()
2126+{
2127 this->instance()->m_log_on_delete = false;
2128 return *this;
2129 }
2130
2131-inline Errata::Data::Data() {}
2132-inline size_t Errata::Data::size() const { return m_items.size(); }
2133-
2134-inline Errata::iterator::iterator() { }
2135-inline Errata::iterator::iterator(self const& that) : super(that) { }
2136-inline Errata::iterator::iterator(super const& that) : super(that) { }
2137-inline Errata::iterator& Errata::iterator::operator = (self const& that) { this->super::operator = (that); return *this; }
2138-inline Errata::iterator& Errata::iterator::operator = (super const& that) { this->super::operator = (that); return *this; }
2139-inline Errata::iterator& Errata::iterator::operator ++ () { this->super::operator ++ (); return *this; }
2140-inline Errata::iterator& Errata::iterator::operator -- () { this->super::operator -- (); return *this; }
2141-
2142-inline Errata::const_iterator::const_iterator() { }
2143-inline Errata::const_iterator::const_iterator(self const& that) : super(that) { }
2144-inline Errata::const_iterator::const_iterator(super const& that) : super(that) { }
2145-inline Errata::const_iterator& Errata::const_iterator::operator = (self const& that) { super::operator = (that); return *this; }
2146-inline Errata::const_iterator& Errata::const_iterator::operator = (super const& that) { super::operator = (that); return *this; }
2147-inline Errata::const_iterator& Errata::const_iterator::operator ++ () { this->super::operator ++ (); return *this; }
2148-inline Errata::const_iterator& Errata::const_iterator::operator -- () { this->super::operator -- (); return *this; }
2149-
2150-inline RvBase::RvBase() { }
2151-inline RvBase::RvBase(Errata const& errata) : _errata(errata) { }
2152-inline bool RvBase::isOK() const { return _errata; }
2153-inline void RvBase::clear() { _errata.clear(); }
2154-inline void RvBase::doNotLog() { _errata.doNotLog(); }
2155-
2156-template < typename T > Rv<T>::Rv() : _result() { }
2157-template < typename T > Rv<T>::Rv(Result const& r) : _result(r) { }
2158-template < typename T > Rv<T>::Rv(Result const& r, Errata const& errata)
2159- : super(errata)
2160- , _result(r) {
2161-}
2162-template < typename T > Rv<T>::operator Result const&() const {
2163+inline Errata::Data::Data() {}
2164+inline size_t
2165+Errata::Data::size() const
2166+{
2167+ return m_items.size();
2168+}
2169+
2170+inline Errata::iterator::iterator() {}
2171+inline Errata::iterator::iterator(self const &that) : super(that) {}
2172+inline Errata::iterator::iterator(super const &that) : super(that) {}
2173+inline Errata::iterator &
2174+Errata::iterator::operator=(self const &that)
2175+{
2176+ this->super::operator=(that);
2177+ return *this;
2178+}
2179+inline Errata::iterator &
2180+Errata::iterator::operator=(super const &that)
2181+{
2182+ this->super::operator=(that);
2183+ return *this;
2184+}
2185+inline Errata::iterator &
2186+Errata::iterator::operator++()
2187+{
2188+ this->super::operator++();
2189+ return *this;
2190+}
2191+inline Errata::iterator &
2192+Errata::iterator::operator--()
2193+{
2194+ this->super::operator--();
2195+ return *this;
2196+}
2197+
2198+inline Errata::const_iterator::const_iterator() {}
2199+inline Errata::const_iterator::const_iterator(self const &that) : super(that) {}
2200+inline Errata::const_iterator::const_iterator(super const &that) : super(that) {}
2201+inline Errata::const_iterator &
2202+Errata::const_iterator::operator=(self const &that)
2203+{
2204+ super::operator=(that);
2205+ return *this;
2206+}
2207+inline Errata::const_iterator &
2208+Errata::const_iterator::operator=(super const &that)
2209+{
2210+ super::operator=(that);
2211+ return *this;
2212+}
2213+inline Errata::const_iterator &
2214+Errata::const_iterator::operator++()
2215+{
2216+ this->super::operator++();
2217+ return *this;
2218+}
2219+inline Errata::const_iterator &
2220+Errata::const_iterator::operator--()
2221+{
2222+ this->super::operator--();
2223+ return *this;
2224+}
2225+
2226+inline RvBase::RvBase() {}
2227+inline RvBase::RvBase(Errata const &errata) : _errata(errata) {}
2228+inline bool
2229+RvBase::isOK() const
2230+{
2231+ return _errata;
2232+}
2233+inline void
2234+RvBase::clear()
2235+{
2236+ _errata.clear();
2237+}
2238+inline void
2239+RvBase::doNotLog()
2240+{
2241+ _errata.doNotLog();
2242+}
2243+
2244+template <typename T> Rv<T>::Rv() : _result() {}
2245+template <typename T> Rv<T>::Rv(Result const &r) : _result(r) {}
2246+template <typename T> Rv<T>::Rv(Result const &r, Errata const &errata) : super(errata), _result(r) {}
2247+template <typename T> Rv<T>::operator Result const &() const
2248+{
2249+ return _result;
2250+}
2251+template <typename T>
2252+T const &
2253+Rv<T>::result() const
2254+{
2255+ return _result;
2256+}
2257+template <typename T>
2258+T &
2259+Rv<T>::result()
2260+{
2261 return _result;
2262 }
2263-template < typename T > T const& Rv<T>::result() const { return _result; }
2264-template < typename T > T& Rv<T>::result() { return _result; }
2265-template < typename T > Errata const& Rv<T>::errata() const { return _errata; }
2266-template < typename T > Errata& Rv<T>::errata() { return _errata; }
2267-template < typename T > Rv<T>&
2268-Rv<T>::set(Result const& r) {
2269+template <typename T>
2270+Errata const &
2271+Rv<T>::errata() const
2272+{
2273+ return _errata;
2274+}
2275+template <typename T>
2276+Errata &
2277+Rv<T>::errata()
2278+{
2279+ return _errata;
2280+}
2281+template <typename T>
2282+Rv<T> &
2283+Rv<T>::set(Result const &r)
2284+{
2285 _result = r;
2286 return *this;
2287 }
2288-template < typename T > Rv<T>&
2289-Rv<T>::operator = (Errata const& errata) {
2290+template <typename T>
2291+Rv<T> &
2292+Rv<T>::operator=(Errata const &errata)
2293+{
2294 _errata = errata;
2295 return *this;
2296 }
2297-template < typename T > Rv<T>&
2298-Rv<T>::push(Errata::Message const& msg) {
2299+template <typename T>
2300+Rv<T> &
2301+Rv<T>::push(Errata::Message const &msg)
2302+{
2303 _errata.push(msg);
2304 return *this;
2305 }
2306-template < typename T > template < typename U > Rv<T>&
2307-Rv<T>::push(Rv<U> const& that) {
2308+template <typename T>
2309+template <typename U>
2310+Rv<T> &
2311+Rv<T>::push(Rv<U> const &that)
2312+{
2313 _errata.push(that.errata());
2314 return *this;
2315 }
2316@@ -929,4 +1021,4 @@ Rv<T>::push(Rv<U> const& that) {
2317 /* ----------------------------------------------------------------------- */
2318 } // namespace ts
2319
2320-# endif // TS_ERRATA_HEADER
2321+#endif // TS_ERRATA_HEADER
2322diff --git a/lib/tsconfig/IntrusivePtr.h b/lib/tsconfig/IntrusivePtr.h
2323index cb09d0a32..dcf54aef0 100644
2324--- a/lib/tsconfig/IntrusivePtr.h
2325+++ b/lib/tsconfig/IntrusivePtr.h
2326@@ -39,8 +39,7 @@
2327
2328 namespace ts
2329 {
2330-
2331-template < typename T > class IntrusivePtr; // forward declare
2332+template <typename T> class IntrusivePtr; // forward declare
2333
2334 /* ----------------------------------------------------------------------- */
2335 /** Reference counter mixin.
2336@@ -62,9 +61,10 @@ template < typename T > class IntrusivePtr; // forward declare
2337 */
2338 class IntrusivePtrCounter
2339 {
2340- template < typename T > friend class IntrusivePtr;
2341+ template <typename T> friend class IntrusivePtr;
2342
2343 using self_type = IntrusivePtrCounter;
2344+
2345 public:
2346 /** Copy constructor.
2347
2348@@ -72,9 +72,9 @@ public:
2349 client that uses a default copy constructor will _copy the ref count into the new object_.
2350 That way lies madness.
2351 */
2352- IntrusivePtrCounter(self_type const & that);
2353+ IntrusivePtrCounter(self_type const &that);
2354 /// No move constructor - that won't work for an object that is the target of a shared pointer.
2355- IntrusivePtrCounter(self_type && that) = delete;
2356+ IntrusivePtrCounter(self_type &&that) = delete;
2357
2358 /** Assignment operator.
2359
2360@@ -100,15 +100,15 @@ protected:
2361 */
2362 class IntrusivePtrAtomicCounter
2363 {
2364- template < typename T > friend class IntrusivePtr;
2365+ template <typename T> friend class IntrusivePtr;
2366
2367 using self_type = IntrusivePtrAtomicCounter; ///< Self reference type.
2368
2369 public:
2370 /// Copy constructor - do not copy reference count.
2371- IntrusivePtrAtomicCounter(self_type const & that);
2372+ IntrusivePtrAtomicCounter(self_type const &that);
2373 /// No move constructor - that won't work for an object that is the target of a shared pointer.
2374- IntrusivePtrAtomicCounter(self_type && that) = delete;
2375+ IntrusivePtrAtomicCounter(self_type &&that) = delete;
2376
2377 /// Self assignment - do not copy reference count.
2378 self_type &operator=(self_type const &that);
2379@@ -144,9 +144,9 @@ protected:
2380 */
2381 template <typename T> class IntrusivePtr
2382 {
2383-private: /* don't pollute client with these typedefs */
2384- using self_type = IntrusivePtr; ///< Self reference type.
2385- template < typename U > friend class IntrusivePtr; // Make friends with siblings for cross type casts.
2386+private: /* don't pollute client with these typedefs */
2387+ using self_type = IntrusivePtr; ///< Self reference type.
2388+ template <typename U> friend class IntrusivePtr; // Make friends with siblings for cross type casts.
2389 public:
2390 /// The externally used type for the reference count.
2391 using counter_type = long int;
2392@@ -160,13 +160,13 @@ public:
2393 ~IntrusivePtr();
2394
2395 /// Copy constructor. A new reference to the object is created.
2396- IntrusivePtr(self_type const& that);
2397+ IntrusivePtr(self_type const &that);
2398 /// Move constructor. The reference in @a that is moved to @a this.
2399- IntrusivePtr(self_type && that);
2400+ IntrusivePtr(self_type &&that);
2401 /// Self assignment. A new reference to the object is created.
2402- self_type& operator=(self_type const& that);
2403+ self_type &operator=(self_type const &that);
2404 /// Move assignment. The reference in @a that is moved to @a this.
2405- self_type& operator=(self_type && that);
2406+ self_type &operator=(self_type &&that);
2407
2408 /** Assign from instance.
2409
2410@@ -190,7 +190,7 @@ public:
2411 @return @c true if there are no references upon return,
2412 @c false if the reference count is not zero.
2413 */
2414- T* release();
2415+ T *release();
2416
2417 /// Test for not @c nullptr
2418 explicit operator bool() const;
2419@@ -213,20 +213,16 @@ public:
2420 /** Cross type construction.
2421 This succeeds if an @a U* can be implicitly converted to a @a T*.
2422 */
2423- template <typename U>
2424- IntrusivePtr(IntrusivePtr<U> const &that);
2425+ template <typename U> IntrusivePtr(IntrusivePtr<U> const &that);
2426
2427- template <typename U>
2428- IntrusivePtr(IntrusivePtr<U> && that);
2429+ template <typename U> IntrusivePtr(IntrusivePtr<U> &&that);
2430
2431 /** Cross type assignment.
2432 This succeeds if an @a U* can be implicitily converted to a @a T*.
2433 */
2434- template <typename U>
2435- self_type &operator=(IntrusivePtr<U> const &that);
2436+ template <typename U> self_type &operator=(IntrusivePtr<U> const &that);
2437
2438- template <typename U>
2439- self_type &operator=(IntrusivePtr<U> && that);
2440+ template <typename U> self_type &operator=(IntrusivePtr<U> &&that);
2441
2442 /// Reference count.
2443 /// @return Number of references.
2444@@ -345,7 +341,8 @@ public:
2445 };
2446
2447 // If no specialization is provided then use the default;
2448-template < typename T > struct IntrusivePtrPolicy : public IntrusivePtrDefaultPolicy<T> {};
2449+template <typename T> struct IntrusivePtrPolicy : public IntrusivePtrDefaultPolicy<T> {
2450+};
2451 /* ----------------------------------------------------------------------- */
2452 /* ----------------------------------------------------------------------- */
2453 /* Inline Methods */
2454@@ -405,60 +402,53 @@ template <typename T> IntrusivePtr<T>::~IntrusivePtr()
2455 this->unset();
2456 }
2457
2458-template < typename T >
2459-IntrusivePtr<T>::IntrusivePtr(self_type const &that)
2460+template <typename T> IntrusivePtr<T>::IntrusivePtr(self_type const &that)
2461 {
2462 this->set(that.m_obj);
2463 }
2464
2465-template <typename T>
2466-template <typename U>
2467-IntrusivePtr<T>::IntrusivePtr(IntrusivePtr<U> const &that)
2468+template <typename T> template <typename U> IntrusivePtr<T>::IntrusivePtr(IntrusivePtr<U> const &that)
2469 {
2470- static_assert(std::is_convertible<U*, T*>::value, "The argument type is not implicitly convertible to the return type.");
2471+ static_assert(std::is_convertible<U *, T *>::value, "The argument type is not implicitly convertible to the return type.");
2472 this->set(that.m_obj);
2473 }
2474
2475-template < typename T >
2476-IntrusivePtr<T>::IntrusivePtr(self_type && that)
2477+template <typename T> IntrusivePtr<T>::IntrusivePtr(self_type &&that)
2478 {
2479- std::swap<T*>(m_obj, that.m_obj);
2480+ std::swap<T *>(m_obj, that.m_obj);
2481 }
2482
2483-template <typename T>
2484-template <typename U>
2485-IntrusivePtr<T>::IntrusivePtr(IntrusivePtr<U> && that)
2486+template <typename T> template <typename U> IntrusivePtr<T>::IntrusivePtr(IntrusivePtr<U> &&that)
2487 {
2488- static_assert(std::is_convertible<U*, T*>::value, "The argument type is not implicitly convertible to the return type.");
2489- std::swap<T*>(m_obj, that.get());
2490+ static_assert(std::is_convertible<U *, T *>::value, "The argument type is not implicitly convertible to the return type.");
2491+ std::swap<T *>(m_obj, that.get());
2492 }
2493
2494-template < typename T >
2495+template <typename T>
2496 IntrusivePtr<T> &
2497-IntrusivePtr<T>::operator=(self_type const& that)
2498+IntrusivePtr<T>::operator=(self_type const &that)
2499 {
2500 this->reset(that.get());
2501 return *this;
2502 }
2503
2504-
2505 template <typename T>
2506 template <typename U>
2507 IntrusivePtr<T> &
2508-IntrusivePtr<T>::operator=(IntrusivePtr<U> const& that)
2509+IntrusivePtr<T>::operator=(IntrusivePtr<U> const &that)
2510 {
2511- static_assert(std::is_convertible<U*, T*>::value, "The argument type is not implicitly convertible to the return type.");
2512+ static_assert(std::is_convertible<U *, T *>::value, "The argument type is not implicitly convertible to the return type.");
2513 this->reset(that.get());
2514 return *this;
2515 }
2516
2517-template < typename T >
2518+template <typename T>
2519 IntrusivePtr<T> &
2520-IntrusivePtr<T>::operator=(self_type && that)
2521+IntrusivePtr<T>::operator=(self_type &&that)
2522 {
2523 if (m_obj != that.m_obj) {
2524 this->unset();
2525- m_obj = that.m_obj;
2526+ m_obj = that.m_obj;
2527 that.m_obj = nullptr;
2528 } else {
2529 that.unset();
2530@@ -469,12 +459,12 @@ IntrusivePtr<T>::operator=(self_type && that)
2531 template <typename T>
2532 template <typename U>
2533 IntrusivePtr<T> &
2534-IntrusivePtr<T>::operator=(IntrusivePtr<U> && that)
2535+IntrusivePtr<T>::operator=(IntrusivePtr<U> &&that)
2536 {
2537- static_assert(std::is_convertible<U*, T*>::value, "The argument type is not implicitly convertible to the return type.");
2538+ static_assert(std::is_convertible<U *, T *>::value, "The argument type is not implicitly convertible to the return type.");
2539 if (m_obj != that.m_obj) {
2540 this->unset();
2541- m_obj = that.m_obj;
2542+ m_obj = that.m_obj;
2543 that.m_obj = nullptr;
2544 } else {
2545 that.unset();
2546@@ -530,7 +520,7 @@ template <typename T>
2547 void
2548 IntrusivePtr<T>::set(T *obj)
2549 {
2550- m_obj = obj; /* update to new object */
2551+ m_obj = obj; /* update to new object */
2552 if (nullptr != m_obj) /* if a real object, bump the ref count */
2553 ++(m_obj->m_intrusive_pointer_reference_count);
2554 }
2555@@ -546,10 +536,10 @@ IntrusivePtr<T>::reset(T *obj)
2556 }
2557
2558 template <typename T>
2559-T*
2560+T *
2561 IntrusivePtr<T>::release()
2562 {
2563- T* zret = m_obj;
2564+ T *zret = m_obj;
2565 if (m_obj) {
2566 auto &cp = m_obj->m_intrusive_pointer_reference_count;
2567 // If the client is using this method, they're doing something funky
2568@@ -561,8 +551,7 @@ IntrusivePtr<T>::release()
2569 return zret;
2570 }
2571
2572-template <typename T>
2573-IntrusivePtr<T>::operator bool() const
2574+template <typename T> IntrusivePtr<T>::operator bool() const
2575 {
2576 return m_obj != nullptr;
2577 }
2578diff --git a/lib/tsconfig/NumericType.h b/lib/tsconfig/NumericType.h
2579index d8bf41c7e..1a488ee4a 100644
2580--- a/lib/tsconfig/NumericType.h
2581+++ b/lib/tsconfig/NumericType.h
2582@@ -1,5 +1,5 @@
2583-# if !defined(TS_NUMERIC_TYPE_HEADER)
2584-# define TS_NUMERIC_TYPE_HEADER
2585+#if !defined(TS_NUMERIC_TYPE_HEADER)
2586+#define TS_NUMERIC_TYPE_HEADER
2587
2588 /** @file
2589
2590@@ -41,12 +41,12 @@
2591 limitations under the License.
2592 */
2593
2594-# include <limits>
2595-
2596-namespace ts {
2597+#include <limits>
2598
2599+namespace ts
2600+{
2601 // Forward declare.
2602-template < typename T, typename X > class NumericType;
2603+template <typename T, typename X> class NumericType;
2604
2605 /// @cond NOT_DOCUMENTED
2606 /** Support template for resolving operator ambiguity.
2607@@ -65,26 +65,25 @@ template < typename T, typename X > class NumericType;
2608 @internal Note that we don't have to provide an actual implementation
2609 for these operators. Funky, isn't it?
2610 */
2611-template <
2612- typename T, ///< Base numeric type.
2613- typename X ///< Distinguishing tag type.
2614-> class NumericTypeIntOperators {
2615+template <typename T, ///< Base numeric type.
2616+ typename X ///< Distinguishing tag type.
2617+ >
2618+class NumericTypeIntOperators
2619+{
2620 public:
2621- NumericType<T,X>& operator += ( int t );
2622- NumericType<T,X>& operator -= ( int t );
2623-
2624- // Must have const and non-const versions.
2625- NumericType<T,X> operator + ( int t );
2626- NumericType<T,X> operator - ( int t );
2627- NumericType<T,X> operator + ( int t ) const;
2628- NumericType<T,X> operator - ( int t ) const;
2629+ NumericType<T, X> &operator+=(int t);
2630+ NumericType<T, X> &operator-=(int t);
2631+
2632+ // Must have const and non-const versions.
2633+ NumericType<T, X> operator+(int t);
2634+ NumericType<T, X> operator-(int t);
2635+ NumericType<T, X> operator+(int t) const;
2636+ NumericType<T, X> operator-(int t) const;
2637 };
2638
2639-template < typename T, typename X > NumericType<T,X>
2640-operator + ( int t, NumericTypeIntOperators<T,X> const& );
2641+template <typename T, typename X> NumericType<T, X> operator+(int t, NumericTypeIntOperators<T, X> const &);
2642
2643-template < typename T, typename X > NumericType<T,X>
2644-operator - ( int t, NumericTypeIntOperators<T,X> const& );
2645+template <typename T, typename X> NumericType<T, X> operator-(int t, NumericTypeIntOperators<T, X> const &);
2646
2647 /// @endcond
2648
2649@@ -93,91 +92,187 @@ operator - ( int t, NumericTypeIntOperators<T,X> const& );
2650 @internal One issue is that this is not a POD and so doesn't work
2651 with @c printf. I will need to investigate what that would take.
2652 */
2653-template <
2654- typename T, ///< Base numeric type.
2655- typename X ///< Distinguishing tag type.
2656-> class NumericType : public NumericTypeIntOperators<T,X> {
2657+template <typename T, ///< Base numeric type.
2658+ typename X ///< Distinguishing tag type.
2659+ >
2660+class NumericType : public NumericTypeIntOperators<T, X>
2661+{
2662 public:
2663- typedef T raw_type; //!< Base builtin type.
2664- typedef NumericType self; //!< Self reference type.
2665-
2666- /// @cond NOT_DOCUMENTED
2667- // Need to import these to avoid compiler problems.
2668- using NumericTypeIntOperators<T,X>::operator +=;
2669- using NumericTypeIntOperators<T,X>::operator -=;
2670- using NumericTypeIntOperators<T,X>::operator +;
2671- using NumericTypeIntOperators<T,X>::operator -;
2672- /// @endcond
2673-
2674- /// Default constructor, uninitialized.
2675- NumericType();
2676- //! Construct from implementation type.
2677- NumericType(
2678- raw_type const t ///< Initialized value.
2679- );
2680- //! Assignment from implementation type.
2681- NumericType & operator = (raw_type const t);
2682- //! Self assignment.
2683- NumericType & operator = (self const& that);
2684-
2685- /// User conversion to implementation type.
2686- /// @internal If we have just a single const method conversion to a copy
2687- /// of the @c raw_type then the stream operators don't work. Only a CR
2688- /// conversion operator satisifies the argument matching.
2689- operator raw_type const& () const { return _t; }
2690- /// User conversion to implementation type.
2691- operator raw_type& () { return _t; }
2692- /// Explicit conversion to host type
2693- raw_type raw() const { return _t; }
2694-
2695- // User conversions to raw type provide the standard comparison operators.
2696- self& operator += ( self const& that );
2697- self& operator -= ( self const& that );
2698-
2699- self& operator += ( raw_type t );
2700- self& operator -= ( raw_type t );
2701-
2702- self operator + ( self const& that );
2703- self operator - ( self const& that );
2704-
2705- self operator + ( raw_type t );
2706- self operator - ( raw_type t );
2707-
2708- self& operator ++();
2709- self operator ++(int);
2710- self& operator --();
2711- self operator --(int);
2712+ typedef T raw_type; //!< Base builtin type.
2713+ typedef NumericType self; //!< Self reference type.
2714+
2715+ /// @cond NOT_DOCUMENTED
2716+ // Need to import these to avoid compiler problems.
2717+ using NumericTypeIntOperators<T, X>::operator+=;
2718+ using NumericTypeIntOperators<T, X>::operator-=;
2719+ using NumericTypeIntOperators<T, X>::operator+;
2720+ using NumericTypeIntOperators<T, X>::operator-;
2721+ /// @endcond
2722+
2723+ /// Default constructor, uninitialized.
2724+ NumericType();
2725+ //! Construct from implementation type.
2726+ NumericType(raw_type const t ///< Initialized value.
2727+ );
2728+ //! Assignment from implementation type.
2729+ NumericType &operator=(raw_type const t);
2730+ //! Self assignment.
2731+ NumericType &operator=(self const &that);
2732+
2733+ /// User conversion to implementation type.
2734+ /// @internal If we have just a single const method conversion to a copy
2735+ /// of the @c raw_type then the stream operators don't work. Only a CR
2736+ /// conversion operator satisifies the argument matching.
2737+ operator raw_type const &() const { return _t; }
2738+ /// User conversion to implementation type.
2739+ operator raw_type &() { return _t; }
2740+ /// Explicit conversion to host type
2741+ raw_type
2742+ raw() const
2743+ {
2744+ return _t;
2745+ }
2746+
2747+ // User conversions to raw type provide the standard comparison operators.
2748+ self &operator+=(self const &that);
2749+ self &operator-=(self const &that);
2750+
2751+ self &operator+=(raw_type t);
2752+ self &operator-=(raw_type t);
2753+
2754+ self operator+(self const &that);
2755+ self operator-(self const &that);
2756+
2757+ self operator+(raw_type t);
2758+ self operator-(raw_type t);
2759+
2760+ self &operator++();
2761+ self operator++(int);
2762+ self &operator--();
2763+ self operator--(int);
2764
2765 private:
2766- raw_type _t;
2767+ raw_type _t;
2768 };
2769
2770 // Method definitions.
2771 // coverity[uninit_ctor]
2772-template < typename T, typename X > NumericType<T,X>::NumericType() { }
2773-template < typename T, typename X > NumericType<T,X>::NumericType(raw_type const t) : _t(t) { }
2774-template < typename T, typename X > NumericType<T,X>& NumericType<T,X>::operator = (raw_type const t) { _t = t; return *this; }
2775-template < typename T, typename X > NumericType<T,X>& NumericType<T,X>::operator = (self const& that) { _t = that._t; return *this; }
2776-
2777-template < typename T, typename X > NumericType<T,X>& NumericType<T,X>::operator += ( self const& that ) { _t += that._t; return *this; }
2778-template < typename T, typename X > NumericType<T,X>& NumericType<T,X>::operator -= ( self const& that ) { _t -= that._t; return *this; }
2779-template < typename T, typename X > NumericType<T,X> NumericType<T,X>::operator + ( self const& that ) { return self(_t + that._t); }
2780-template < typename T, typename X > NumericType<T,X> NumericType<T,X>::operator - ( self const& that ) { return self(_t - that._t); }
2781-
2782-template < typename T, typename X > NumericType<T,X>& NumericType<T,X>::operator += ( raw_type t ) { _t += t; return *this; }
2783-template < typename T, typename X > NumericType<T,X>& NumericType<T,X>::operator -= ( raw_type t ) { _t -= t; return *this; }
2784-template < typename T, typename X > NumericType<T,X> NumericType<T,X>::operator + ( raw_type t ) { return self(_t + t); }
2785-template < typename T, typename X > NumericType<T,X> NumericType<T,X>::operator - ( raw_type t ) { return self(_t - t); }
2786-
2787-template < typename T, typename X > NumericType<T,X>& NumericType<T,X>::operator ++() { ++_t; return *this; }
2788-template < typename T, typename X > NumericType<T,X>& NumericType<T,X>::operator --() { --_t; return *this; }
2789-template < typename T, typename X > NumericType<T,X> NumericType<T,X>::operator ++(int) { self tmp(*this); ++_t; return tmp; }
2790-template < typename T, typename X > NumericType<T,X> NumericType<T,X>::operator --(int) { self tmp(*this); --_t; return tmp; }
2791-
2792-template < typename T, typename X > NumericType<T,X> operator + ( T const& lhs, NumericType<T,X> const& rhs ) { return rhs + lhs; }
2793-template < typename T, typename X > NumericType<T,X> operator - ( T const& lhs, NumericType<T,X> const& rhs ) { return NumericType<T,X>(lhs - rhs.raw()); }
2794+template <typename T, typename X> NumericType<T, X>::NumericType() {}
2795+template <typename T, typename X> NumericType<T, X>::NumericType(raw_type const t) : _t(t) {}
2796+template <typename T, typename X>
2797+NumericType<T, X> &
2798+NumericType<T, X>::operator=(raw_type const t)
2799+{
2800+ _t = t;
2801+ return *this;
2802+}
2803+template <typename T, typename X>
2804+NumericType<T, X> &
2805+NumericType<T, X>::operator=(self const &that)
2806+{
2807+ _t = that._t;
2808+ return *this;
2809+}
2810+
2811+template <typename T, typename X>
2812+NumericType<T, X> &
2813+NumericType<T, X>::operator+=(self const &that)
2814+{
2815+ _t += that._t;
2816+ return *this;
2817+}
2818+template <typename T, typename X>
2819+NumericType<T, X> &
2820+NumericType<T, X>::operator-=(self const &that)
2821+{
2822+ _t -= that._t;
2823+ return *this;
2824+}
2825+template <typename T, typename X>
2826+NumericType<T, X>
2827+NumericType<T, X>::operator+(self const &that)
2828+{
2829+ return self(_t + that._t);
2830+}
2831+template <typename T, typename X>
2832+NumericType<T, X>
2833+NumericType<T, X>::operator-(self const &that)
2834+{
2835+ return self(_t - that._t);
2836+}
2837+
2838+template <typename T, typename X>
2839+NumericType<T, X> &
2840+NumericType<T, X>::operator+=(raw_type t)
2841+{
2842+ _t += t;
2843+ return *this;
2844+}
2845+template <typename T, typename X>
2846+NumericType<T, X> &
2847+NumericType<T, X>::operator-=(raw_type t)
2848+{
2849+ _t -= t;
2850+ return *this;
2851+}
2852+template <typename T, typename X>
2853+NumericType<T, X>
2854+NumericType<T, X>::operator+(raw_type t)
2855+{
2856+ return self(_t + t);
2857+}
2858+template <typename T, typename X>
2859+NumericType<T, X>
2860+NumericType<T, X>::operator-(raw_type t)
2861+{
2862+ return self(_t - t);
2863+}
2864+
2865+template <typename T, typename X>
2866+NumericType<T, X> &
2867+NumericType<T, X>::operator++()
2868+{
2869+ ++_t;
2870+ return *this;
2871+}
2872+template <typename T, typename X>
2873+NumericType<T, X> &
2874+NumericType<T, X>::operator--()
2875+{
2876+ --_t;
2877+ return *this;
2878+}
2879+template <typename T, typename X>
2880+NumericType<T, X>
2881+NumericType<T, X>::operator++(int)
2882+{
2883+ self tmp(*this);
2884+ ++_t;
2885+ return tmp;
2886+}
2887+template <typename T, typename X>
2888+NumericType<T, X>
2889+NumericType<T, X>::operator--(int)
2890+{
2891+ self tmp(*this);
2892+ --_t;
2893+ return tmp;
2894+}
2895+
2896+template <typename T, typename X>
2897+NumericType<T, X>
2898+operator+(T const &lhs, NumericType<T, X> const &rhs)
2899+{
2900+ return rhs + lhs;
2901+}
2902+template <typename T, typename X>
2903+NumericType<T, X>
2904+operator-(T const &lhs, NumericType<T, X> const &rhs)
2905+{
2906+ return NumericType<T, X>(lhs - rhs.raw());
2907+}
2908
2909 /* ----------------------------------------------------------------------- */
2910 } /* end namespace ts */
2911 /* ----------------------------------------------------------------------- */
2912-# endif // TS_NUMERIC_TYPE_HEADER
2913+#endif // TS_NUMERIC_TYPE_HEADER
2914diff --git a/lib/tsconfig/TsBuilder.cc b/lib/tsconfig/TsBuilder.cc
2915index c174de1ec..6c2b61419 100644
2916--- a/lib/tsconfig/TsBuilder.cc
2917+++ b/lib/tsconfig/TsBuilder.cc
2918@@ -21,141 +21,165 @@
2919 limitations under the License.
2920 */
2921
2922-# include "TsBuilder.h"
2923-# include "TsErrataUtil.h"
2924-# include "TsConfigLexer.h"
2925-# include "TsConfigGrammar.hpp"
2926-# include <cstdlib>
2927+#include "TsBuilder.h"
2928+#include "TsErrataUtil.h"
2929+#include "TsConfigLexer.h"
2930+#include "TsConfigGrammar.hpp"
2931+#include <cstdlib>
2932
2933 // Prefix for text of our messages.
2934-# define PRE "Configuration Parser: "
2935+#define PRE "Configuration Parser: "
2936
2937-namespace {
2938+namespace
2939+{
2940 /** Compress a string by removing escape characters.
2941 @return The new length of the string.
2942 */
2943-size_t unescape_string(char* text, size_t len) {
2944+size_t
2945+unescape_string(char *text, size_t len)
2946+{
2947 size_t zret = len;
2948 // quick check - if no escape char, do nothing.
2949- char* dst = static_cast<char*>(memchr(text, '\\', len));
2950+ char *dst = static_cast<char *>(memchr(text, '\\', len));
2951 if (dst) {
2952- char* limit = text + len;
2953- char* src = dst + 1; // skip escape char
2954- for ( *dst++ = *src++ ; src < limit ; ++src ) {
2955- if ('\\' != *src) { *dst++ = *src;
2956- } else if (++src < limit) { *dst++ = *src;
2957- } else { *dst++ = '\\'; // trailing backslash.
2958-
2959-}
2960-}zret = dst - text;
2961+ char *limit = text + len;
2962+ char *src = dst + 1; // skip escape char
2963+ for (*dst++ = *src++; src < limit; ++src) {
2964+ if ('\\' != *src) {
2965+ *dst++ = *src;
2966+ } else if (++src < limit) {
2967+ *dst++ = *src;
2968+ } else {
2969+ *dst++ = '\\'; // trailing backslash.
2970+ }
2971+ }
2972+ zret = dst - text;
2973 }
2974 return zret;
2975 }
2976-} // anon namespace
2977-
2978-namespace ts { namespace config {
2979-
2980-Builder&
2981-Builder::init() {
2982- // Fill in each element to dispatch through the static
2983- // method. Callback data is a pointer to an entry in @c dispatch
2984- // which contains pointer to this object and a pointer to the
2985- // appropriate dispatch method.
2986-
2987- // Zero everything first, just to be safe.
2988- memset(_dispatch, 0, sizeof(_dispatch));
2989- memset(&_loc, 0, sizeof(_loc));
2990-
2991- for ( size_t i = 0 ; i < TS_CONFIG_N_EVENT_TYPES ; ++i) {
2992- _dispatch[i]._ptr = this;
2993- _handlers.handler[i]._f = &self::dispatch;
2994- _handlers.handler[i]._data = &(_dispatch[i]);
2995- }
2996-
2997- _dispatch[TsConfigEventGroupOpen]._method = &self::groupOpen;
2998- _dispatch[TsConfigEventGroupName]._method = &self::groupName;
2999- _dispatch[TsConfigEventGroupClose]._method = &self::groupClose;
3000- _dispatch[TsConfigEventListOpen]._method = &self::listOpen;
3001- _dispatch[TsConfigEventListClose]._method = &self::listClose;
3002- _dispatch[TsConfigEventPathOpen]._method = &self::pathOpen;
3003- _dispatch[TsConfigEventPathTag]._method = &self::pathTag;
3004- _dispatch[TsConfigEventPathIndex]._method = &self::pathIndex;
3005- _dispatch[TsConfigEventPathClose]._method = &self::pathClose;
3006- _dispatch[TsConfigEventLiteralValue]._method = &self::literalValue;
3007- _dispatch[TsConfigEventInvalidToken]._method = &self::invalidToken;
3008-
3009- _handlers.error._data = this;
3010- _handlers.error._f = &self::syntaxErrorDispatch;
3011-
3012- return *this;
3013-}
3014+} // namespace
3015
3016-// Error messages here have to just be logged, as they effectively report that
3017-// the dispatcher can't find the builder object.
3018-void
3019-Builder::dispatch(void* data, Token* token) {
3020+namespace ts
3021+{
3022+namespace config
3023+{
3024+ Builder &
3025+ Builder::init()
3026+ {
3027+ // Fill in each element to dispatch through the static
3028+ // method. Callback data is a pointer to an entry in @c dispatch
3029+ // which contains pointer to this object and a pointer to the
3030+ // appropriate dispatch method.
3031+
3032+ // Zero everything first, just to be safe.
3033+ memset(_dispatch, 0, sizeof(_dispatch));
3034+ memset(&_loc, 0, sizeof(_loc));
3035+
3036+ for (size_t i = 0; i < TS_CONFIG_N_EVENT_TYPES; ++i) {
3037+ _dispatch[i]._ptr = this;
3038+ _handlers.handler[i]._f = &self::dispatch;
3039+ _handlers.handler[i]._data = &(_dispatch[i]);
3040+ }
3041+
3042+ _dispatch[TsConfigEventGroupOpen]._method = &self::groupOpen;
3043+ _dispatch[TsConfigEventGroupName]._method = &self::groupName;
3044+ _dispatch[TsConfigEventGroupClose]._method = &self::groupClose;
3045+ _dispatch[TsConfigEventListOpen]._method = &self::listOpen;
3046+ _dispatch[TsConfigEventListClose]._method = &self::listClose;
3047+ _dispatch[TsConfigEventPathOpen]._method = &self::pathOpen;
3048+ _dispatch[TsConfigEventPathTag]._method = &self::pathTag;
3049+ _dispatch[TsConfigEventPathIndex]._method = &self::pathIndex;
3050+ _dispatch[TsConfigEventPathClose]._method = &self::pathClose;
3051+ _dispatch[TsConfigEventLiteralValue]._method = &self::literalValue;
3052+ _dispatch[TsConfigEventInvalidToken]._method = &self::invalidToken;
3053+
3054+ _handlers.error._data = this;
3055+ _handlers.error._f = &self::syntaxErrorDispatch;
3056+
3057+ return *this;
3058+ }
3059+
3060+ // Error messages here have to just be logged, as they effectively report that
3061+ // the dispatcher can't find the builder object.
3062+ void
3063+ Builder::dispatch(void *data, Token *token)
3064+ {
3065 if (data) {
3066- Handler* handler = reinterpret_cast<Handler*>(data);
3067- if (handler->_ptr) {
3068- if (handler->_method) {
3069- ((handler->_ptr)->*(handler->_method))(*token);
3070- } else {
3071- msg::logf(msg::WARN, PRE "Unable to dispatch event - no method.");
3072- }
3073+ Handler *handler = reinterpret_cast<Handler *>(data);
3074+ if (handler->_ptr) {
3075+ if (handler->_method) {
3076+ ((handler->_ptr)->*(handler->_method))(*token);
3077 } else {
3078- msg::logf(msg::WARN, PRE "Unable to dispatch event - no builder.");
3079+ msg::logf(msg::WARN, PRE "Unable to dispatch event - no method.");
3080 }
3081+ } else {
3082+ msg::logf(msg::WARN, PRE "Unable to dispatch event - no builder.");
3083+ }
3084 } else {
3085- msg::logf(msg::WARN, PRE "Unable to dispatch event - no handler.");
3086+ msg::logf(msg::WARN, PRE "Unable to dispatch event - no handler.");
3087 }
3088-}
3089+ }
3090
3091-int
3092-Builder::syntaxErrorDispatch(void* data, char const* text) {
3093- return reinterpret_cast<Builder*>(data)->syntaxError(text);
3094-}
3095+ int
3096+ Builder::syntaxErrorDispatch(void *data, char const *text)
3097+ {
3098+ return reinterpret_cast<Builder *>(data)->syntaxError(text);
3099+ }
3100
3101-int
3102-Builder::syntaxError(char const* text) {
3103- msg::logf(_errata, msg::WARN,
3104- "Syntax error '%s' near line %d, column %d.",
3105- text, tsconfiglex_current_line(), tsconfiglex_current_col()
3106- );
3107- return 0;
3108-}
3109+ int
3110+ Builder::syntaxError(char const *text)
3111+ {
3112+ msg::logf(_errata, msg::WARN, "Syntax error '%s' near line %d, column %d.", text, tsconfiglex_current_line(),
3113+ tsconfiglex_current_col());
3114+ return 0;
3115+ }
3116
3117-Rv<Configuration>
3118-Builder::build(Buffer const& buffer) {
3119- _v = _config.getRoot(); // seed current value.
3120- _errata.clear(); // no errors yet.
3121- tsconfig_parse_buffer(&_handlers, buffer._ptr, buffer._size);
3122- return MakeRv(_config, _errata);
3123-}
3124+ Rv<Configuration>
3125+ Builder::build(Buffer const &buffer)
3126+ {
3127+ _v = _config.getRoot(); // seed current value.
3128+ _errata.clear(); // no errors yet.
3129+ tsconfig_parse_buffer(&_handlers, buffer._ptr, buffer._size);
3130+ return MakeRv(_config, _errata);
3131+ }
3132
3133-void
3134-Builder::groupOpen(Token const& token) {
3135+ void
3136+ Builder::groupOpen(Token const &token)
3137+ {
3138 _v = _v.makeGroup(_name);
3139 _v.setSource(token._loc._line, token._loc._col);
3140-}
3141-void Builder::groupClose(Token const&) {
3142+ }
3143+ void
3144+ Builder::groupClose(Token const &)
3145+ {
3146 _v = _v.getParent();
3147-}
3148-void Builder::groupName(Token const& token) {
3149+ }
3150+ void
3151+ Builder::groupName(Token const &token)
3152+ {
3153 _name.set(token._s, token._n);
3154-}
3155-void Builder::listOpen(Token const& token) {
3156+ }
3157+ void
3158+ Builder::listOpen(Token const &token)
3159+ {
3160 _v = _v.makeList(_name);
3161 _v.setSource(token._loc._line, token._loc._col);
3162-}
3163-void Builder::listClose(Token const&) {
3164+ }
3165+ void
3166+ Builder::listClose(Token const &)
3167+ {
3168 _v = _v.getParent();
3169-}
3170+ }
3171
3172-void Builder::pathOpen(Token const&) {
3173+ void
3174+ Builder::pathOpen(Token const &)
3175+ {
3176 _path.reset();
3177 _extent.reset();
3178-}
3179-void Builder::pathTag(Token const& token) {
3180+ }
3181+ void
3182+ Builder::pathTag(Token const &token)
3183+ {
3184 _path.append(Buffer(token._s, token._n));
3185 if (_extent._ptr) {
3186 _extent._size = token._s - _extent._ptr + token._n;
3187@@ -163,18 +187,24 @@ void Builder::pathTag(Token const& token) {
3188 _extent.set(token._s, token._n);
3189 _loc = token._loc;
3190 }
3191-}
3192-void Builder::pathIndex(Token const& token){
3193+ }
3194+ void
3195+ Builder::pathIndex(Token const &token)
3196+ {
3197 // We take advantage of the lexer - token will always be a valid
3198 // digit string that is followed by a non-digit or the FLEX
3199 // required double null at the end of the input buffer.
3200 _path.append(Buffer(nullptr, static_cast<size_t>(atol(token._s))));
3201- if (_extent._ptr) { _extent._size = token._s - _extent._ptr + token._n;
3202- } else { _extent.set(token._s, token._n);
3203-}
3204-}
3205+ if (_extent._ptr) {
3206+ _extent._size = token._s - _extent._ptr + token._n;
3207+ } else {
3208+ _extent.set(token._s, token._n);
3209+ }
3210+ }
3211
3212-void Builder::pathClose(Token const&) {
3213+ void
3214+ Builder::pathClose(Token const &)
3215+ {
3216 Rv<Value> cv = _v.makePath(_path, _name);
3217 if (cv.isOK()) {
3218 cv.result().setText(_extent).setSource(_loc._line, _loc._col);
3219@@ -184,9 +214,11 @@ void Builder::pathClose(Token const&) {
3220 }
3221 _name.reset();
3222 _extent.reset();
3223-}
3224+ }
3225
3226-void Builder::literalValue(Token const& token) {
3227+ void
3228+ Builder::literalValue(Token const &token)
3229+ {
3230 Rv<Value> cv;
3231 Buffer text(token._s, token._n);
3232
3233@@ -199,22 +231,28 @@ void Builder::literalValue(Token const& token) {
3234 // Note the nul is *not* included in the reported length.
3235
3236 if (INTEGER == token._type) {
3237- cv = _v.makeInteger(text, _name);
3238- token._s[token._n] = 0;
3239+ cv = _v.makeInteger(text, _name);
3240+ token._s[token._n] = 0;
3241 } else if (STRING == token._type) {
3242- ++text._ptr, text._size -= 2; // Don't include the quotes.
3243- text._size = unescape_string(text._ptr, text._size);
3244- text._ptr[text._size] = 0; // OK because we have the trailing quote.
3245- cv = _v.makeString(text, _name);
3246+ ++text._ptr, text._size -= 2; // Don't include the quotes.
3247+ text._size = unescape_string(text._ptr, text._size);
3248+ text._ptr[text._size] = 0; // OK because we have the trailing quote.
3249+ cv = _v.makeString(text, _name);
3250 } else {
3251- msg::logf(_errata, msg::WARN, PRE "Unexpected literal type %d.", token._type);
3252+ msg::logf(_errata, msg::WARN, PRE "Unexpected literal type %d.", token._type);
3253 }
3254- if (!cv.isOK()) { _errata.pull(cv.errata());
3255-}
3256- if (cv.result()) { cv.result().setSource(token._loc._line, token._loc._col);
3257-}
3258- _name.set(nullptr,0); // used, so clear it.
3259-}
3260-void Builder::invalidToken(Token const&) { }
3261+ if (!cv.isOK()) {
3262+ _errata.pull(cv.errata());
3263+ }
3264+ if (cv.result()) {
3265+ cv.result().setSource(token._loc._line, token._loc._col);
3266+ }
3267+ _name.set(nullptr, 0); // used, so clear it.
3268+ }
3269+ void
3270+ Builder::invalidToken(Token const &)
3271+ {
3272+ }
3273
3274-}} // namespace ts::config
3275+} // namespace config
3276+} // namespace ts
3277diff --git a/lib/tsconfig/TsBuilder.h b/lib/tsconfig/TsBuilder.h
3278index de765bee9..927c4d9b7 100644
3279--- a/lib/tsconfig/TsBuilder.h
3280+++ b/lib/tsconfig/TsBuilder.h
3281@@ -1,5 +1,5 @@
3282-# if ! defined(TS_CONFIG_BUILDER_HEADER)
3283-# define TS_CONFIG_BUILDER_HEADER
3284+#if !defined(TS_CONFIG_BUILDER_HEADER)
3285+#define TS_CONFIG_BUILDER_HEADER
3286
3287 /** @file
3288
3289@@ -24,78 +24,82 @@
3290 limitations under the License.
3291 */
3292
3293-# include "TsValue.h"
3294-# include "TsConfigTypes.h"
3295-# include "TsConfigParseEvents.h"
3296-
3297-namespace ts { namespace config {
3298-
3299-/** Class to build the configuration table from parser events.
3300- */
3301-class Builder {
3302-public:
3303- typedef Builder self;
3304- struct Handler {
3305- self* _ptr = nullptr; ///< Pointer to Builder instance.
3306- /// Pointer to method to invoke for this event.
3307- void (self::*_method)(Token const& token) = nullptr;
3308+#include "TsValue.h"
3309+#include "TsConfigTypes.h"
3310+#include "TsConfigParseEvents.h"
3311+
3312+namespace ts
3313+{
3314+namespace config
3315+{
3316+ /** Class to build the configuration table from parser events.
3317+ */
3318+ class Builder
3319+ {
3320+ public:
3321+ typedef Builder self;
3322+ struct Handler {
3323+ self *_ptr = nullptr; ///< Pointer to Builder instance.
3324+ /// Pointer to method to invoke for this event.
3325+ void (self::*_method)(Token const &token) = nullptr;
3326+
3327+ /// Default constructor.
3328+ Handler();
3329+ };
3330
3331 /// Default constructor.
3332- Handler();
3333+ Builder();
3334+ /// Destructor.
3335+ virtual ~Builder() {}
3336+ /// Construct with existing configuration.
3337+ Builder(Configuration const &config);
3338+ /// Build the table.
3339+ /// @return The configuration or error status.
3340+ Rv<Configuration> build(Buffer const &buffer ///< Input text.
3341+ );
3342+
3343+ protected:
3344+ /// Dispatch table for parse events.
3345+ Handler _dispatch[TS_CONFIG_N_EVENT_TYPES];
3346+ /// Event handler table for the parser.
3347+ TsConfigHandlers _handlers;
3348+ /// Dispatch methods
3349+ virtual void groupOpen(Token const &token);
3350+ virtual void groupClose(Token const &token);
3351+ virtual void groupName(Token const &token);
3352+ virtual void listOpen(Token const &token);
3353+ virtual void listClose(Token const &token);
3354+ virtual void pathOpen(Token const &token);
3355+ virtual void pathTag(Token const &token);
3356+ virtual void pathIndex(Token const &token);
3357+ virtual void pathClose(Token const &token);
3358+ virtual void literalValue(Token const &token);
3359+ virtual void invalidToken(Token const &token);
3360+ /// Syntax error handler
3361+ virtual int syntaxError(char const *text);
3362+ /// Static method to handle parser event callbacks.
3363+ static void dispatch(void *data, Token *token);
3364+ /// Static method for syntax errors.
3365+ static int syntaxErrorDispatch(void *data, char const *text);
3366+
3367+ // Building state.
3368+ Configuration _config; ///< Configuration to update.
3369+ Errata _errata; ///< Error accumulator.
3370+ Value _v; ///< Current value.
3371+ Buffer _name; ///< Pending group name, if any.
3372+ Buffer _extent; ///< Accumulator for multi-token text.
3373+ Location _loc; ///< Cache for multi-token text.
3374+ Path _path; ///< Path accumulator
3375+
3376+ /// Initialization, called from constructors.
3377+ self &init();
3378 };
3379
3380- /// Default constructor.
3381- Builder();
3382- /// Destructor.
3383- virtual ~Builder() {}
3384- /// Construct with existing configuration.
3385- Builder(Configuration const& config);
3386- /// Build the table.
3387- /// @return The configuration or error status.
3388- Rv<Configuration> build(
3389- Buffer const& buffer ///< Input text.
3390- );
3391- protected:
3392- /// Dispatch table for parse events.
3393- Handler _dispatch[TS_CONFIG_N_EVENT_TYPES];
3394- /// Event handler table for the parser.
3395- TsConfigHandlers _handlers;
3396- /// Dispatch methods
3397- virtual void groupOpen(Token const& token);
3398- virtual void groupClose(Token const& token);
3399- virtual void groupName(Token const& token);
3400- virtual void listOpen(Token const& token);
3401- virtual void listClose(Token const& token);
3402- virtual void pathOpen(Token const& token);
3403- virtual void pathTag(Token const& token);
3404- virtual void pathIndex(Token const& token);
3405- virtual void pathClose(Token const& token);
3406- virtual void literalValue(Token const& token);
3407- virtual void invalidToken(Token const& token);
3408- /// Syntax error handler
3409- virtual int syntaxError(char const* text);
3410- /// Static method to handle parser event callbacks.
3411- static void dispatch(void* data, Token* token);
3412- /// Static method for syntax errors.
3413- static int syntaxErrorDispatch(void* data, char const* text);
3414-
3415- // Building state.
3416- Configuration _config; ///< Configuration to update.
3417- Errata _errata; ///< Error accumulator.
3418- Value _v; ///< Current value.
3419- Buffer _name; ///< Pending group name, if any.
3420- Buffer _extent; ///< Accumulator for multi-token text.
3421- Location _loc; ///< Cache for multi-token text.
3422- Path _path; ///< Path accumulator
3423-
3424- /// Initialization, called from constructors.
3425- self& init();
3426-};
3427-
3428-inline Builder::Handler::Handler() { }
3429-inline Builder::Builder() { this->init(); }
3430-inline Builder::Builder(Configuration const& config) : _config(config) { this->init(); }
3431-
3432-}} // namespace ts::config
3433-
3434-# endif // TS_CONFIG_BUILDER_HEADER
3435+ inline Builder::Handler::Handler() {}
3436+ inline Builder::Builder() { this->init(); }
3437+ inline Builder::Builder(Configuration const &config) : _config(config) { this->init(); }
3438+
3439+} // namespace config
3440+} // namespace ts
3441+
3442+#endif // TS_CONFIG_BUILDER_HEADER
3443diff --git a/lib/tsconfig/TsConfigGrammar.c b/lib/tsconfig/TsConfigGrammar.c
3444index 025b4f987..83bed7305 100644
3445--- a/lib/tsconfig/TsConfigGrammar.c
3446+++ b/lib/tsconfig/TsConfigGrammar.c
3447@@ -61,59 +61,57 @@
3448 /* "%code top" blocks. */
3449 #line 26 "TsConfigGrammar.y" /* yacc.c:316 */
3450
3451-# if ! (defined(__clang_analyzer__) || defined(__COVERITY__))
3452-# include "TsConfigTypes.h"
3453-# include <stdlib.h>
3454+#if !(defined(__clang_analyzer__) || defined(__COVERITY__))
3455+#include "TsConfigTypes.h"
3456+#include <stdlib.h>
3457
3458 // Inhibit Bison definitions.
3459-# define YYMALLOC malloc
3460-# define YYFREE free
3461+#define YYMALLOC malloc
3462+#define YYFREE free
3463
3464-# include "TsConfigParseEvents.h"
3465-# include "tscore/ink_defs.h"
3466+#include "TsConfigParseEvents.h"
3467+#include "tscore/ink_defs.h"
3468
3469 // Types we need for the lexer.
3470-typedef void* yyscan_t;
3471-extern int tsconfiglex(YYSTYPE* yylval, yyscan_t lexer);
3472-
3473+typedef void *yyscan_t;
3474+extern int tsconfiglex(YYSTYPE *yylval, yyscan_t lexer);
3475
3476 #line 81 "TsConfigGrammar.c" /* yacc.c:316 */
3477
3478 /* Substitute the variable and function names. */
3479-#define yyparse tsconfigparse
3480-#define yylex tsconfiglex
3481-#define yyerror tsconfigerror
3482-#define yydebug tsconfigdebug
3483-#define yynerrs tsconfignerrs
3484-
3485+#define yyparse tsconfigparse
3486+#define yylex tsconfiglex
3487+#define yyerror tsconfigerror
3488+#define yydebug tsconfigdebug
3489+#define yynerrs tsconfignerrs
3490
3491 /* Copy the first part of user declarations. */
3492
3493 #line 93 "TsConfigGrammar.c" /* yacc.c:339 */
3494
3495-# ifndef YY_NULLPTR
3496-# if defined __cplusplus && 201103L <= __cplusplus
3497-# define YY_NULLPTR nullptr
3498-# else
3499-# define YY_NULLPTR 0
3500-# endif
3501-# endif
3502+#ifndef YY_NULLPTR
3503+#if defined __cplusplus && 201103L <= __cplusplus
3504+#define YY_NULLPTR nullptr
3505+#else
3506+#define YY_NULLPTR 0
3507+#endif
3508+#endif
3509
3510 /* Enabling verbose error messages. */
3511 #ifdef YYERROR_VERBOSE
3512-# undef YYERROR_VERBOSE
3513-# define YYERROR_VERBOSE 1
3514+#undef YYERROR_VERBOSE
3515+#define YYERROR_VERBOSE 1
3516 #else
3517-# define YYERROR_VERBOSE 1
3518+#define YYERROR_VERBOSE 1
3519 #endif
3520
3521 /* In a future release of Bison, this section will be replaced
3522 by #include "y.tab.h". */
3523 #ifndef YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED
3524-# define YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED
3525+#define YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED
3526 /* Debug traces. */
3527 #ifndef YYDEBUG
3528-# define YYDEBUG 0
3529+#define YYDEBUG 0
3530 #endif
3531 #if YYDEBUG
3532 extern int tsconfigdebug;
3533@@ -148,22 +146,21 @@ extern int tsconfigdebug;
3534
3535 /* Token type. */
3536 #ifndef YYTOKENTYPE
3537-# define YYTOKENTYPE
3538- enum yytokentype
3539- {
3540- STRING = 258,
3541- IDENT = 259,
3542- INTEGER = 260,
3543- LIST_OPEN = 261,
3544- LIST_CLOSE = 262,
3545- GROUP_OPEN = 263,
3546- GROUP_CLOSE = 264,
3547- PATH_OPEN = 265,
3548- PATH_CLOSE = 266,
3549- PATH_SEPARATOR = 267,
3550- SEPARATOR = 268,
3551- ASSIGN = 269
3552- };
3553+#define YYTOKENTYPE
3554+enum yytokentype {
3555+ STRING = 258,
3556+ IDENT = 259,
3557+ INTEGER = 260,
3558+ LIST_OPEN = 261,
3559+ LIST_CLOSE = 262,
3560+ GROUP_OPEN = 263,
3561+ GROUP_CLOSE = 264,
3562+ PATH_OPEN = 265,
3563+ PATH_CLOSE = 266,
3564+ PATH_SEPARATOR = 267,
3565+ SEPARATOR = 268,
3566+ ASSIGN = 269
3567+};
3568 #endif
3569 /* Tokens. */
3570 #define STRING 258
3571@@ -180,15 +177,13 @@ extern int tsconfigdebug;
3572 #define ASSIGN 269
3573
3574 /* Value type. */
3575-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
3576+#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED
3577 typedef int YYSTYPE;
3578-# define YYSTYPE_IS_TRIVIAL 1
3579-# define YYSTYPE_IS_DECLARED 1
3580+#define YYSTYPE_IS_TRIVIAL 1
3581+#define YYSTYPE_IS_DECLARED 1
3582 #endif
3583
3584-
3585-
3586-int tsconfigparse (yyscan_t lexer, struct TsConfigHandlers* handlers);
3587+int tsconfigparse(yyscan_t lexer, struct TsConfigHandlers *handlers);
3588
3589 #endif /* !YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED */
3590
3591@@ -198,29 +193,23 @@ int tsconfigparse (yyscan_t lexer, struct TsConfigHandlers* handlers);
3592 /* Unqualified %code blocks. */
3593 #line 44 "TsConfigGrammar.y" /* yacc.c:359 */
3594
3595-
3596-# define HANDLE_EVENT(x,y) \
3597+#define HANDLE_EVENT(x, y) \
3598 if (handlers) { \
3599- struct TsConfigEventHandler* h = &(handlers->handler[TsConfigEvent##x]); \
3600- if (h->_f) h->_f(h->_data, &(y)); \
3601+ struct TsConfigEventHandler *h = &(handlers->handler[TsConfigEvent##x]); \
3602+ if (h->_f) \
3603+ h->_f(h->_data, &(y)); \
3604 }
3605
3606-int tsconfigerror(
3607- yyscan_t lexer ATS_UNUSED,
3608- struct TsConfigHandlers* handlers,
3609- char const* text
3610-) {
3611- return (handlers && handlers->error._f)
3612- ? handlers->error._f(handlers->error._data, text)
3613- : 0
3614- ;
3615+int
3616+tsconfigerror(yyscan_t lexer ATS_UNUSED, struct TsConfigHandlers *handlers, char const *text)
3617+{
3618+ return (handlers && handlers->error._f) ? handlers->error._f(handlers->error._data, text) : 0;
3619 }
3620
3621-
3622 #line 221 "TsConfigGrammar.c" /* yacc.c:359 */
3623
3624 #ifdef short
3625-# undef short
3626+#undef short
3627 #endif
3628
3629 #ifdef YYTYPE_UINT8
3630@@ -248,501 +237,389 @@ typedef short int yytype_int16;
3631 #endif
3632
3633 #ifndef YYSIZE_T
3634-# ifdef __SIZE_TYPE__
3635-# define YYSIZE_T __SIZE_TYPE__
3636-# elif defined size_t
3637-# define YYSIZE_T size_t
3638-# elif ! defined YYSIZE_T
3639-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
3640-# define YYSIZE_T size_t
3641-# else
3642-# define YYSIZE_T unsigned int
3643-# endif
3644+#ifdef __SIZE_TYPE__
3645+#define YYSIZE_T __SIZE_TYPE__
3646+#elif defined size_t
3647+#define YYSIZE_T size_t
3648+#elif !defined YYSIZE_T
3649+#include <stddef.h> /* INFRINGES ON USER NAME SPACE */
3650+#define YYSIZE_T size_t
3651+#else
3652+#define YYSIZE_T unsigned int
3653+#endif
3654 #endif
3655
3656-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
3657+#define YYSIZE_MAXIMUM ((YYSIZE_T)-1)
3658
3659 #ifndef YY_
3660-# if defined YYENABLE_NLS && YYENABLE_NLS
3661-# if ENABLE_NLS
3662-# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
3663-# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
3664-# endif
3665-# endif
3666-# ifndef YY_
3667-# define YY_(Msgid) Msgid
3668-# endif
3669+#if defined YYENABLE_NLS && YYENABLE_NLS
3670+#if ENABLE_NLS
3671+#include <libintl.h> /* INFRINGES ON USER NAME SPACE */
3672+#define YY_(Msgid) dgettext("bison-runtime", Msgid)
3673+#endif
3674+#endif
3675+#ifndef YY_
3676+#define YY_(Msgid) Msgid
3677+#endif
3678 #endif
3679
3680 #ifndef YY_ATTRIBUTE
3681-# if (defined __GNUC__ \
3682- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
3683- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
3684-# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
3685-# else
3686-# define YY_ATTRIBUTE(Spec) /* empty */
3687-# endif
3688+#if (defined __GNUC__ && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
3689+#define YY_ATTRIBUTE(Spec) __attribute__(Spec)
3690+#else
3691+#define YY_ATTRIBUTE(Spec) /* empty */
3692+#endif
3693 #endif
3694
3695 #ifndef YY_ATTRIBUTE_PURE
3696-# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
3697+#define YY_ATTRIBUTE_PURE YY_ATTRIBUTE((__pure__))
3698 #endif
3699
3700 #ifndef YY_ATTRIBUTE_UNUSED
3701-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
3702+#define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE((__unused__))
3703 #endif
3704
3705-#if !defined _Noreturn \
3706- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
3707-# if defined _MSC_VER && 1200 <= _MSC_VER
3708-# define _Noreturn __declspec (noreturn)
3709-# else
3710-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
3711-# endif
3712+#if !defined _Noreturn && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
3713+#if defined _MSC_VER && 1200 <= _MSC_VER
3714+#define _Noreturn __declspec(noreturn)
3715+#else
3716+#define _Noreturn YY_ATTRIBUTE((__noreturn__))
3717+#endif
3718 #endif
3719
3720 /* Suppress unused-variable warnings by "using" E. */
3721-#if ! defined lint || defined __GNUC__
3722-# define YYUSE(E) ((void) (E))
3723+#if !defined lint || defined __GNUC__
3724+#define YYUSE(E) ((void)(E))
3725 #else
3726-# define YYUSE(E) /* empty */
3727+#define YYUSE(E) /* empty */
3728 #endif
3729
3730 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
3731 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
3732-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
3733- _Pragma ("GCC diagnostic push") \
3734- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
3735- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
3736-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
3737- _Pragma ("GCC diagnostic pop")
3738+#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
3739+ _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
3740+ _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
3741+#define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop")
3742 #else
3743-# define YY_INITIAL_VALUE(Value) Value
3744+#define YY_INITIAL_VALUE(Value) Value
3745 #endif
3746 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3747-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3748-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
3749+#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3750+#define YY_IGNORE_MAYBE_UNINITIALIZED_END
3751 #endif
3752 #ifndef YY_INITIAL_VALUE
3753-# define YY_INITIAL_VALUE(Value) /* Nothing. */
3754+#define YY_INITIAL_VALUE(Value) /* Nothing. */
3755 #endif
3756
3757-
3758-#if ! defined yyoverflow || YYERROR_VERBOSE
3759+#if !defined yyoverflow || YYERROR_VERBOSE
3760
3761 /* The parser invokes alloca or malloc; define the necessary symbols. */
3762
3763-# ifdef YYSTACK_USE_ALLOCA
3764-# if YYSTACK_USE_ALLOCA
3765-# ifdef __GNUC__
3766-# define YYSTACK_ALLOC __builtin_alloca
3767-# elif defined __BUILTIN_VA_ARG_INCR
3768-# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
3769-# elif defined _AIX
3770-# define YYSTACK_ALLOC __alloca
3771-# elif defined _MSC_VER
3772-# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
3773-# define alloca _alloca
3774-# else
3775-# define YYSTACK_ALLOC alloca
3776-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
3777-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
3778- /* Use EXIT_SUCCESS as a witness for stdlib.h. */
3779-# ifndef EXIT_SUCCESS
3780-# define EXIT_SUCCESS 0
3781-# endif
3782-# endif
3783-# endif
3784-# endif
3785-# endif
3786-
3787-# ifdef YYSTACK_ALLOC
3788- /* Pacify GCC's 'empty if-body' warning. */
3789-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
3790-# ifndef YYSTACK_ALLOC_MAXIMUM
3791- /* The OS might guarantee only one guard page at the bottom of the stack,
3792- and a page size can be as small as 4096 bytes. So we cannot safely
3793- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
3794- to allow for a few compiler-allocated temporary stack slots. */
3795-# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
3796-# endif
3797-# else
3798-# define YYSTACK_ALLOC YYMALLOC
3799-# define YYSTACK_FREE YYFREE
3800-# ifndef YYSTACK_ALLOC_MAXIMUM
3801-# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
3802-# endif
3803-# if (defined __cplusplus && ! defined EXIT_SUCCESS \
3804- && ! ((defined YYMALLOC || defined malloc) \
3805- && (defined YYFREE || defined free)))
3806-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
3807-# ifndef EXIT_SUCCESS
3808-# define EXIT_SUCCESS 0
3809-# endif
3810-# endif
3811-# ifndef YYMALLOC
3812-# define YYMALLOC malloc
3813-# if ! defined malloc && ! defined EXIT_SUCCESS
3814-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
3815-# endif
3816-# endif
3817-# ifndef YYFREE
3818-# define YYFREE free
3819-# if ! defined free && ! defined EXIT_SUCCESS
3820-void free (void *); /* INFRINGES ON USER NAME SPACE */
3821-# endif
3822-# endif
3823-# endif
3824-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
3825+#ifdef YYSTACK_USE_ALLOCA
3826+#if YYSTACK_USE_ALLOCA
3827+#ifdef __GNUC__
3828+#define YYSTACK_ALLOC __builtin_alloca
3829+#elif defined __BUILTIN_VA_ARG_INCR
3830+#include <alloca.h> /* INFRINGES ON USER NAME SPACE */
3831+#elif defined _AIX
3832+#define YYSTACK_ALLOC __alloca
3833+#elif defined _MSC_VER
3834+#include <malloc.h> /* INFRINGES ON USER NAME SPACE */
3835+#define alloca _alloca
3836+#else
3837+#define YYSTACK_ALLOC alloca
3838+#if !defined _ALLOCA_H && !defined EXIT_SUCCESS
3839+#include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
3840+/* Use EXIT_SUCCESS as a witness for stdlib.h. */
3841+#ifndef EXIT_SUCCESS
3842+#define EXIT_SUCCESS 0
3843+#endif
3844+#endif
3845+#endif
3846+#endif
3847+#endif
3848
3849+#ifdef YYSTACK_ALLOC
3850+/* Pacify GCC's 'empty if-body' warning. */
3851+#define YYSTACK_FREE(Ptr) \
3852+ do { /* empty */ \
3853+ ; \
3854+ } while (0)
3855+#ifndef YYSTACK_ALLOC_MAXIMUM
3856+/* The OS might guarantee only one guard page at the bottom of the stack,
3857+ and a page size can be as small as 4096 bytes. So we cannot safely
3858+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
3859+ to allow for a few compiler-allocated temporary stack slots. */
3860+#define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
3861+#endif
3862+#else
3863+#define YYSTACK_ALLOC YYMALLOC
3864+#define YYSTACK_FREE YYFREE
3865+#ifndef YYSTACK_ALLOC_MAXIMUM
3866+#define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
3867+#endif
3868+#if (defined __cplusplus && !defined EXIT_SUCCESS && !((defined YYMALLOC || defined malloc) && (defined YYFREE || defined free)))
3869+#include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
3870+#ifndef EXIT_SUCCESS
3871+#define EXIT_SUCCESS 0
3872+#endif
3873+#endif
3874+#ifndef YYMALLOC
3875+#define YYMALLOC malloc
3876+#if !defined malloc && !defined EXIT_SUCCESS
3877+void *malloc(YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
3878+#endif
3879+#endif
3880+#ifndef YYFREE
3881+#define YYFREE free
3882+#if !defined free && !defined EXIT_SUCCESS
3883+void free(void *); /* INFRINGES ON USER NAME SPACE */
3884+#endif
3885+#endif
3886+#endif
3887+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
3888
3889-#if (! defined yyoverflow \
3890- && (! defined __cplusplus \
3891- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
3892+#if (!defined yyoverflow && (!defined __cplusplus || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
3893
3894 /* A type that is properly aligned for any stack member. */
3895-union yyalloc
3896-{
3897+union yyalloc {
3898 yytype_int16 yyss_alloc;
3899 YYSTYPE yyvs_alloc;
3900 };
3901
3902 /* The size of the maximum gap between one aligned stack and the next. */
3903-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
3904+#define YYSTACK_GAP_MAXIMUM (sizeof(union yyalloc) - 1)
3905
3906 /* The size of an array large to enough to hold all stacks, each with
3907 N elements. */
3908-# define YYSTACK_BYTES(N) \
3909- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
3910- + YYSTACK_GAP_MAXIMUM)
3911+#define YYSTACK_BYTES(N) ((N) * (sizeof(yytype_int16) + sizeof(YYSTYPE)) + YYSTACK_GAP_MAXIMUM)
3912
3913-# define YYCOPY_NEEDED 1
3914+#define YYCOPY_NEEDED 1
3915
3916 /* Relocate STACK from its old location to the new one. The
3917 local variables YYSIZE and YYSTACKSIZE give the old and new number of
3918 elements in the stack, and YYPTR gives the new location of the
3919 stack. Advance YYPTR to a properly aligned location for the next
3920 stack. */
3921-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
3922- do \
3923- { \
3924- YYSIZE_T yynewbytes; \
3925- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
3926- Stack = &yyptr->Stack_alloc; \
3927- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
3928- yyptr += yynewbytes / sizeof (*yyptr); \
3929- } \
3930- while (0)
3931+#define YYSTACK_RELOCATE(Stack_alloc, Stack) \
3932+ do { \
3933+ YYSIZE_T yynewbytes; \
3934+ YYCOPY(&yyptr->Stack_alloc, Stack, yysize); \
3935+ Stack = &yyptr->Stack_alloc; \
3936+ yynewbytes = yystacksize * sizeof(*Stack) + YYSTACK_GAP_MAXIMUM; \
3937+ yyptr += yynewbytes / sizeof(*yyptr); \
3938+ } while (0)
3939
3940 #endif
3941
3942 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
3943 /* Copy COUNT objects from SRC to DST. The source and destination do
3944 not overlap. */
3945-# ifndef YYCOPY
3946-# if defined __GNUC__ && 1 < __GNUC__
3947-# define YYCOPY(Dst, Src, Count) \
3948- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
3949-# else
3950-# define YYCOPY(Dst, Src, Count) \
3951- do \
3952- { \
3953- YYSIZE_T yyi; \
3954- for (yyi = 0; yyi < (Count); yyi++) \
3955- (Dst)[yyi] = (Src)[yyi]; \
3956- } \
3957- while (0)
3958-# endif
3959-# endif
3960+#ifndef YYCOPY
3961+#if defined __GNUC__ && 1 < __GNUC__
3962+#define YYCOPY(Dst, Src, Count) __builtin_memcpy(Dst, Src, (Count) * sizeof(*(Src)))
3963+#else
3964+#define YYCOPY(Dst, Src, Count) \
3965+ do { \
3966+ YYSIZE_T yyi; \
3967+ for (yyi = 0; yyi < (Count); yyi++) \
3968+ (Dst)[yyi] = (Src)[yyi]; \
3969+ } while (0)
3970+#endif
3971+#endif
3972 #endif /* !YYCOPY_NEEDED */
3973
3974 /* YYFINAL -- State number of the termination state. */
3975-#define YYFINAL 3
3976+#define YYFINAL 3
3977 /* YYLAST -- Last index in YYTABLE. */
3978-#define YYLAST 33
3979+#define YYLAST 33
3980
3981 /* YYNTOKENS -- Number of terminals. */
3982-#define YYNTOKENS 15
3983+#define YYNTOKENS 15
3984 /* YYNNTS -- Number of nonterminals. */
3985-#define YYNNTS 20
3986+#define YYNNTS 20
3987 /* YYNRULES -- Number of rules. */
3988-#define YYNRULES 32
3989+#define YYNRULES 32
3990 /* YYNSTATES -- Number of states. */
3991-#define YYNSTATES 44
3992+#define YYNSTATES 44
3993
3994 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
3995 by yylex, with out-of-bounds checking. */
3996-#define YYUNDEFTOK 2
3997-#define YYMAXUTOK 269
3998+#define YYUNDEFTOK 2
3999+#define YYMAXUTOK 269
4000
4001-#define YYTRANSLATE(YYX) \
4002- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
4003+#define YYTRANSLATE(YYX) ((unsigned int)(YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
4004
4005 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
4006 as returned by yylex, without out-of-bounds checking. */
4007-static const yytype_uint8 yytranslate[] =
4008-{
4009- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4010- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4011- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4012- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4013- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4014- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4015- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4016- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4017- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4018- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4019- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4020- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4021- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4022- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4023- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4024- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4025- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4026- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4027- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4028- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4029- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4030- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4031- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4032- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4033- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4034- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
4035- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
4036-};
4037+static const yytype_uint8 yytranslate[] = {
4038+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4039+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4040+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4041+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4042+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4043+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
4044+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
4045
4046 #if YYDEBUG
4047- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
4048-static const yytype_uint8 yyrline[] =
4049-{
4050- 0, 86, 86, 88, 90, 92, 94, 94, 94, 96,
4051- 96, 98, 100, 102, 104, 104, 104, 106, 106, 106,
4052- 106, 108, 108, 108, 110, 110, 112, 114, 116, 118,
4053- 118, 120, 120
4054-};
4055+/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
4056+static const yytype_uint8 yyrline[] = {0, 86, 86, 88, 90, 92, 94, 94, 94, 96, 96, 98, 100, 102, 104, 104, 104,
4057+ 106, 106, 106, 106, 108, 108, 108, 110, 110, 112, 114, 116, 118, 118, 120, 120};
4058 #endif
4059
4060 #if YYDEBUG || YYERROR_VERBOSE || 1
4061 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
4062 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
4063-static const char *const yytname[] =
4064-{
4065- "$end", "error", "$undefined", "STRING", "IDENT", "INTEGER",
4066- "LIST_OPEN", "LIST_CLOSE", "GROUP_OPEN", "GROUP_CLOSE", "PATH_OPEN",
4067- "PATH_CLOSE", "PATH_SEPARATOR", "SEPARATOR", "ASSIGN", "$accept",
4068- "config", "group", "group_open", "group_close", "group_items", "assign",
4069- "$@1", "list", "list_open", "list_close", "list_items", "value",
4070- "literal", "separator", "path", "path_open", "path_close", "path_item",
4071- "path_tag", YY_NULLPTR
4072-};
4073+static const char *const yytname[] = {
4074+ "$end", "error", "$undefined", "STRING", "IDENT", "INTEGER", "LIST_OPEN", "LIST_CLOSE", "GROUP_OPEN",
4075+ "GROUP_CLOSE", "PATH_OPEN", "PATH_CLOSE", "PATH_SEPARATOR", "SEPARATOR", "ASSIGN", "$accept", "config", "group",
4076+ "group_open", "group_close", "group_items", "assign", "$@1", "list", "list_open", "list_close", "list_items",
4077+ "value", "literal", "separator", "path", "path_open", "path_close", "path_item", "path_tag", YY_NULLPTR};
4078 #endif
4079
4080-# ifdef YYPRINT
4081+#ifdef YYPRINT
4082 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
4083 (internal) symbol number NUM (which must be that of a token). */
4084-static const yytype_uint16 yytoknum[] =
4085-{
4086- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
4087- 265, 266, 267, 268, 269
4088-};
4089-# endif
4090+static const yytype_uint16 yytoknum[] = {0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269};
4091+#endif
4092
4093 #define YYPACT_NINF -11
4094
4095-#define yypact_value_is_default(Yystate) \
4096- (!!((Yystate) == (-11)))
4097+#define yypact_value_is_default(Yystate) (!!((Yystate) == (-11)))
4098
4099 #define YYTABLE_NINF -3
4100
4101-#define yytable_value_is_error(Yytable_value) \
4102- 0
4103-
4104- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
4105- STATE-NUM. */
4106-static const yytype_int8 yypact[] =
4107-{
4108- -11, 2, 21, -11, -2, 5, -2, -11, -11, -11,
4109- -11, 10, -11, -11, -11, -11, -11, -11, -11, -11,
4110- -11, -11, -11, -11, -11, 19, 8, 0, -11, -11,
4111- 15, -11, -11, -11, -2, -11, -11, -2, -11, 19,
4112- -11, -11, -11, -11
4113-};
4114-
4115- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
4116- Performed when YYTABLE does not specify something else to do. Zero
4117- means the default is an error. */
4118-static const yytype_uint8 yydefact[] =
4119-{
4120- 6, 0, 0, 1, 24, 0, 24, 25, 8, 9,
4121- 7, 0, 21, 22, 23, 12, 4, 27, 19, 6,
4122- 18, 14, 10, 17, 20, 0, 0, 0, 31, 32,
4123- 0, 29, 5, 3, 24, 13, 11, 24, 28, 0,
4124- 26, 16, 15, 30
4125-};
4126-
4127- /* YYPGOTO[NTERM-NUM]. */
4128-static const yytype_int8 yypgoto[] =
4129-{
4130- -11, -11, -11, -11, -11, 11, -11, -11, -11, -11,
4131- -11, -11, 6, -11, -6, -11, -11, -11, -11, -10
4132-};
4133-
4134- /* YYDEFGOTO[NTERM-NUM]. */
4135-static const yytype_int8 yydefgoto[] =
4136-{
4137- -1, 1, 18, 19, 33, 2, 6, 11, 20, 21,
4138- 36, 27, 22, 23, 8, 24, 25, 40, 30, 31
4139-};
4140-
4141- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
4142- positive, shift that token. If negative, reduce the rule whose
4143- number is the opposite. If YYTABLE_NINF, syntax error. */
4144-static const yytype_int8 yytable[] =
4145-{
4146- 10, 34, 3, 12, 13, 14, 15, 35, 16, 4,
4147- 17, 7, 5, 12, 13, 14, 15, 32, 16, 9,
4148- 17, -2, 4, 28, 29, 5, 38, 39, 41, 43,
4149- 26, 42, 0, 37
4150-};
4151-
4152-static const yytype_int8 yycheck[] =
4153-{
4154- 6, 1, 0, 3, 4, 5, 6, 7, 8, 1,
4155- 10, 13, 4, 3, 4, 5, 6, 9, 8, 14,
4156- 10, 0, 1, 4, 5, 4, 11, 12, 34, 39,
4157- 19, 37, -1, 27
4158-};
4159-
4160- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
4161- symbol of state STATE-NUM. */
4162-static const yytype_uint8 yystos[] =
4163-{
4164- 0, 16, 20, 0, 1, 4, 21, 13, 29, 14,
4165- 29, 22, 3, 4, 5, 6, 8, 10, 17, 18,
4166- 23, 24, 27, 28, 30, 31, 20, 26, 4, 5,
4167- 33, 34, 9, 19, 1, 7, 25, 27, 11, 12,
4168- 32, 29, 29, 34
4169-};
4170-
4171- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
4172-static const yytype_uint8 yyr1[] =
4173-{
4174- 0, 15, 16, 17, 18, 19, 20, 20, 20, 22,
4175- 21, 23, 24, 25, 26, 26, 26, 27, 27, 27,
4176- 27, 28, 28, 28, 29, 29, 30, 31, 32, 33,
4177- 33, 34, 34
4178-};
4179-
4180- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
4181-static const yytype_uint8 yyr2[] =
4182-{
4183- 0, 2, 1, 3, 1, 1, 0, 3, 3, 0,
4184- 4, 3, 1, 1, 0, 3, 3, 1, 1, 1,
4185- 1, 1, 1, 1, 0, 1, 3, 1, 1, 1,
4186- 3, 1, 1
4187-};
4188-
4189-
4190-#define yyerrok (yyerrstatus = 0)
4191-#define yyclearin (yychar = YYEMPTY)
4192-#define YYEMPTY (-2)
4193-#define YYEOF 0
4194-
4195-#define YYACCEPT goto yyacceptlab
4196-#define YYABORT goto yyabortlab
4197-#define YYERROR goto yyerrorlab
4198-
4199-
4200-#define YYRECOVERING() (!!yyerrstatus)
4201-
4202-#define YYBACKUP(Token, Value) \
4203-do \
4204- if (yychar == YYEMPTY) \
4205- { \
4206- yychar = (Token); \
4207- yylval = (Value); \
4208- YYPOPSTACK (yylen); \
4209- yystate = *yyssp; \
4210- goto yybackup; \
4211- } \
4212- else \
4213- { \
4214- yyerror (lexer, handlers, YY_("syntax error: cannot back up")); \
4215- YYERROR; \
4216- } \
4217-while (0)
4218+#define yytable_value_is_error(Yytable_value) 0
4219+
4220+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
4221+ STATE-NUM. */
4222+static const yytype_int8 yypact[] = {-11, 2, 21, -11, -2, 5, -2, -11, -11, -11, -11, 10, -11, -11, -11,
4223+ -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, 19, 8, 0, -11, -11,
4224+ 15, -11, -11, -11, -2, -11, -11, -2, -11, 19, -11, -11, -11, -11};
4225+
4226+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
4227+ Performed when YYTABLE does not specify something else to do. Zero
4228+ means the default is an error. */
4229+static const yytype_uint8 yydefact[] = {6, 0, 0, 1, 24, 0, 24, 25, 8, 9, 7, 0, 21, 22, 23, 12, 4, 27, 19, 6, 18, 14,
4230+ 10, 17, 20, 0, 0, 0, 31, 32, 0, 29, 5, 3, 24, 13, 11, 24, 28, 0, 26, 16, 15, 30};
4231+
4232+/* YYPGOTO[NTERM-NUM]. */
4233+static const yytype_int8 yypgoto[] = {-11, -11, -11, -11, -11, 11, -11, -11, -11, -11,
4234+ -11, -11, 6, -11, -6, -11, -11, -11, -11, -10};
4235+
4236+/* YYDEFGOTO[NTERM-NUM]. */
4237+static const yytype_int8 yydefgoto[] = {-1, 1, 18, 19, 33, 2, 6, 11, 20, 21, 36, 27, 22, 23, 8, 24, 25, 40, 30, 31};
4238+
4239+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
4240+ positive, shift that token. If negative, reduce the rule whose
4241+ number is the opposite. If YYTABLE_NINF, syntax error. */
4242+static const yytype_int8 yytable[] = {10, 34, 3, 12, 13, 14, 15, 35, 16, 4, 17, 7, 5, 12, 13, 14, 15,
4243+ 32, 16, 9, 17, -2, 4, 28, 29, 5, 38, 39, 41, 43, 26, 42, 0, 37};
4244+
4245+static const yytype_int8 yycheck[] = {6, 1, 0, 3, 4, 5, 6, 7, 8, 1, 10, 13, 4, 3, 4, 5, 6,
4246+ 9, 8, 14, 10, 0, 1, 4, 5, 4, 11, 12, 34, 39, 19, 37, -1, 27};
4247+
4248+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
4249+ symbol of state STATE-NUM. */
4250+static const yytype_uint8 yystos[] = {0, 16, 20, 0, 1, 4, 21, 13, 29, 14, 29, 22, 3, 4, 5, 6, 8, 10, 17, 18, 23, 24,
4251+ 27, 28, 30, 31, 20, 26, 4, 5, 33, 34, 9, 19, 1, 7, 25, 27, 11, 12, 32, 29, 29, 34};
4252+
4253+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
4254+static const yytype_uint8 yyr1[] = {0, 15, 16, 17, 18, 19, 20, 20, 20, 22, 21, 23, 24, 25, 26, 26, 26,
4255+ 27, 27, 27, 27, 28, 28, 28, 29, 29, 30, 31, 32, 33, 33, 34, 34};
4256+
4257+/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
4258+static const yytype_uint8 yyr2[] = {0, 2, 1, 3, 1, 1, 0, 3, 3, 0, 4, 3, 1, 1, 0, 3, 3,
4259+ 1, 1, 1, 1, 1, 1, 1, 0, 1, 3, 1, 1, 1, 3, 1, 1};
4260+
4261+#define yyerrok (yyerrstatus = 0)
4262+#define yyclearin (yychar = YYEMPTY)
4263+#define YYEMPTY (-2)
4264+#define YYEOF 0
4265+
4266+#define YYACCEPT goto yyacceptlab
4267+#define YYABORT goto yyabortlab
4268+#define YYERROR goto yyerrorlab
4269+
4270+#define YYRECOVERING() (!!yyerrstatus)
4271+
4272+#define YYBACKUP(Token, Value) \
4273+ do \
4274+ if (yychar == YYEMPTY) { \
4275+ yychar = (Token); \
4276+ yylval = (Value); \
4277+ YYPOPSTACK(yylen); \
4278+ yystate = *yyssp; \
4279+ goto yybackup; \
4280+ } else { \
4281+ yyerror(lexer, handlers, YY_("syntax error: cannot back up")); \
4282+ YYERROR; \
4283+ } \
4284+ while (0)
4285
4286 /* Error token number */
4287-#define YYTERROR 1
4288-#define YYERRCODE 256
4289-
4290-
4291+#define YYTERROR 1
4292+#define YYERRCODE 256
4293
4294 /* Enable debugging if requested. */
4295 #if YYDEBUG
4296
4297-# ifndef YYFPRINTF
4298-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
4299-# define YYFPRINTF fprintf
4300-# endif
4301+#ifndef YYFPRINTF
4302+#include <stdio.h> /* INFRINGES ON USER NAME SPACE */
4303+#define YYFPRINTF fprintf
4304+#endif
4305
4306-# define YYDPRINTF(Args) \
4307-do { \
4308- if (yydebug) \
4309- YYFPRINTF Args; \
4310-} while (0)
4311+#define YYDPRINTF(Args) \
4312+ do { \
4313+ if (yydebug) \
4314+ YYFPRINTF Args; \
4315+ } while (0)
4316
4317 /* This macro is provided for backward compatibility. */
4318 #ifndef YY_LOCATION_PRINT
4319-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
4320+#define YY_LOCATION_PRINT(File, Loc) ((void)0)
4321 #endif
4322
4323-
4324-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
4325-do { \
4326- if (yydebug) \
4327- { \
4328- YYFPRINTF (stderr, "%s ", Title); \
4329- yy_symbol_print (stderr, \
4330- Type, Value, lexer, handlers); \
4331- YYFPRINTF (stderr, "\n"); \
4332- } \
4333-} while (0)
4334-
4335+#define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
4336+ do { \
4337+ if (yydebug) { \
4338+ YYFPRINTF(stderr, "%s ", Title); \
4339+ yy_symbol_print(stderr, Type, Value, lexer, handlers); \
4340+ YYFPRINTF(stderr, "\n"); \
4341+ } \
4342+ } while (0)
4343
4344 /*----------------------------------------.
4345 | Print this symbol's value on YYOUTPUT. |
4346 `----------------------------------------*/
4347
4348 static void
4349-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t lexer, struct TsConfigHandlers* handlers)
4350+yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep, yyscan_t lexer, struct TsConfigHandlers *handlers)
4351 {
4352 FILE *yyo = yyoutput;
4353- YYUSE (yyo);
4354- YYUSE (lexer);
4355- YYUSE (handlers);
4356+ YYUSE(yyo);
4357+ YYUSE(lexer);
4358+ YYUSE(handlers);
4359 if (!yyvaluep)
4360 return;
4361-# ifdef YYPRINT
4362+#ifdef YYPRINT
4363 if (yytype < YYNTOKENS)
4364- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
4365-# endif
4366- YYUSE (yytype);
4367+ YYPRINT(yyoutput, yytoknum[yytype], *yyvaluep);
4368+#endif
4369+ YYUSE(yytype);
4370 }
4371
4372-
4373 /*--------------------------------.
4374 | Print this symbol on YYOUTPUT. |
4375 `--------------------------------*/
4376
4377 static void
4378-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t lexer, struct TsConfigHandlers* handlers)
4379+yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep, yyscan_t lexer, struct TsConfigHandlers *handlers)
4380 {
4381- YYFPRINTF (yyoutput, "%s %s (",
4382- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
4383+ YYFPRINTF(yyoutput, "%s %s (", yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
4384
4385- yy_symbol_value_print (yyoutput, yytype, yyvaluep, lexer, handlers);
4386- YYFPRINTF (yyoutput, ")");
4387+ yy_symbol_value_print(yyoutput, yytype, yyvaluep, lexer, handlers);
4388+ YYFPRINTF(yyoutput, ")");
4389 }
4390
4391 /*------------------------------------------------------------------.
4392@@ -751,68 +628,60 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yys
4393 `------------------------------------------------------------------*/
4394
4395 static void
4396-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
4397+yy_stack_print(yytype_int16 *yybottom, yytype_int16 *yytop)
4398 {
4399- YYFPRINTF (stderr, "Stack now");
4400- for (; yybottom <= yytop; yybottom++)
4401- {
4402- int yybot = *yybottom;
4403- YYFPRINTF (stderr, " %d", yybot);
4404- }
4405- YYFPRINTF (stderr, "\n");
4406+ YYFPRINTF(stderr, "Stack now");
4407+ for (; yybottom <= yytop; yybottom++) {
4408+ int yybot = *yybottom;
4409+ YYFPRINTF(stderr, " %d", yybot);
4410+ }
4411+ YYFPRINTF(stderr, "\n");
4412 }
4413
4414-# define YY_STACK_PRINT(Bottom, Top) \
4415-do { \
4416- if (yydebug) \
4417- yy_stack_print ((Bottom), (Top)); \
4418-} while (0)
4419-
4420+#define YY_STACK_PRINT(Bottom, Top) \
4421+ do { \
4422+ if (yydebug) \
4423+ yy_stack_print((Bottom), (Top)); \
4424+ } while (0)
4425
4426 /*------------------------------------------------.
4427 | Report that the YYRULE is going to be reduced. |
4428 `------------------------------------------------*/
4429
4430 static void
4431-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t lexer, struct TsConfigHandlers* handlers)
4432+yy_reduce_print(yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, yyscan_t lexer, struct TsConfigHandlers *handlers)
4433 {
4434 unsigned long int yylno = yyrline[yyrule];
4435- int yynrhs = yyr2[yyrule];
4436+ int yynrhs = yyr2[yyrule];
4437 int yyi;
4438- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
4439- yyrule - 1, yylno);
4440+ YYFPRINTF(stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno);
4441 /* The symbols being reduced. */
4442- for (yyi = 0; yyi < yynrhs; yyi++)
4443- {
4444- YYFPRINTF (stderr, " $%d = ", yyi + 1);
4445- yy_symbol_print (stderr,
4446- yystos[yyssp[yyi + 1 - yynrhs]],
4447- &(yyvsp[(yyi + 1) - (yynrhs)])
4448- , lexer, handlers);
4449- YYFPRINTF (stderr, "\n");
4450- }
4451+ for (yyi = 0; yyi < yynrhs; yyi++) {
4452+ YYFPRINTF(stderr, " $%d = ", yyi + 1);
4453+ yy_symbol_print(stderr, yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]), lexer, handlers);
4454+ YYFPRINTF(stderr, "\n");
4455+ }
4456 }
4457
4458-# define YY_REDUCE_PRINT(Rule) \
4459-do { \
4460- if (yydebug) \
4461- yy_reduce_print (yyssp, yyvsp, Rule, lexer, handlers); \
4462-} while (0)
4463+#define YY_REDUCE_PRINT(Rule) \
4464+ do { \
4465+ if (yydebug) \
4466+ yy_reduce_print(yyssp, yyvsp, Rule, lexer, handlers); \
4467+ } while (0)
4468
4469 /* Nonzero means print parse trace. It is left uninitialized so that
4470 multiple parsers can coexist. */
4471 int yydebug;
4472 #else /* !YYDEBUG */
4473-# define YYDPRINTF(Args)
4474-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
4475-# define YY_STACK_PRINT(Bottom, Top)
4476-# define YY_REDUCE_PRINT(Rule)
4477+#define YYDPRINTF(Args)
4478+#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
4479+#define YY_STACK_PRINT(Bottom, Top)
4480+#define YY_REDUCE_PRINT(Rule)
4481 #endif /* !YYDEBUG */
4482
4483-
4484 /* YYINITDEPTH -- initial size of the parser's stacks. */
4485 #ifndef YYINITDEPTH
4486-# define YYINITDEPTH 200
4487+#define YYINITDEPTH 200
4488 #endif
4489
4490 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
4491@@ -823,38 +692,37 @@ int yydebug;
4492 evaluated with infinite-precision integer arithmetic. */
4493
4494 #ifndef YYMAXDEPTH
4495-# define YYMAXDEPTH 10000
4496+#define YYMAXDEPTH 10000
4497 #endif
4498
4499-
4500 #if YYERROR_VERBOSE
4501
4502-# ifndef yystrlen
4503-# if defined __GLIBC__ && defined _STRING_H
4504-# define yystrlen strlen
4505-# else
4506+#ifndef yystrlen
4507+#if defined __GLIBC__ && defined _STRING_H
4508+#define yystrlen strlen
4509+#else
4510 /* Return the length of YYSTR. */
4511 static YYSIZE_T
4512-yystrlen (const char *yystr)
4513+yystrlen(const char *yystr)
4514 {
4515 YYSIZE_T yylen;
4516 for (yylen = 0; yystr[yylen]; yylen++)
4517 continue;
4518 return yylen;
4519 }
4520-# endif
4521-# endif
4522+#endif
4523+#endif
4524
4525-# ifndef yystpcpy
4526-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
4527-# define yystpcpy stpcpy
4528-# else
4529+#ifndef yystpcpy
4530+#if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
4531+#define yystpcpy stpcpy
4532+#else
4533 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
4534 YYDEST. */
4535 static char *
4536-yystpcpy (char *yydest, const char *yysrc)
4537+yystpcpy(char *yydest, const char *yysrc)
4538 {
4539- char *yyd = yydest;
4540+ char *yyd = yydest;
4541 const char *yys = yysrc;
4542
4543 while ((*yyd++ = *yys++) != '\0')
4544@@ -862,10 +730,10 @@ yystpcpy (char *yydest, const char *yysrc)
4545
4546 return yyd - 1;
4547 }
4548-# endif
4549-# endif
4550+#endif
4551+#endif
4552
4553-# ifndef yytnamerr
4554+#ifndef yytnamerr
4555 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
4556 quotes and backslashes, so that it's suitable for yyerror. The
4557 heuristic is that double-quoting is unnecessary unless the string
4558@@ -874,44 +742,42 @@ yystpcpy (char *yydest, const char *yysrc)
4559 null, do not copy; instead, return the length of what the result
4560 would have been. */
4561 static YYSIZE_T
4562-yytnamerr (char *yyres, const char *yystr)
4563+yytnamerr(char *yyres, const char *yystr)
4564 {
4565- if (*yystr == '"')
4566- {
4567- YYSIZE_T yyn = 0;
4568- char const *yyp = yystr;
4569-
4570- for (;;)
4571- switch (*++yyp)
4572- {
4573- case '\'':
4574- case ',':
4575- goto do_not_strip_quotes;
4576-
4577- case '\\':
4578- if (*++yyp != '\\')
4579- goto do_not_strip_quotes;
4580- /* Fall through. */
4581- default:
4582- if (yyres)
4583- yyres[yyn] = *yyp;
4584- yyn++;
4585- break;
4586-
4587- case '"':
4588- if (yyres)
4589- yyres[yyn] = '\0';
4590- return yyn;
4591- }
4592- do_not_strip_quotes: ;
4593- }
4594+ if (*yystr == '"') {
4595+ YYSIZE_T yyn = 0;
4596+ char const *yyp = yystr;
4597+
4598+ for (;;)
4599+ switch (*++yyp) {
4600+ case '\'':
4601+ case ',':
4602+ goto do_not_strip_quotes;
4603+
4604+ case '\\':
4605+ if (*++yyp != '\\')
4606+ goto do_not_strip_quotes;
4607+ /* Fall through. */
4608+ default:
4609+ if (yyres)
4610+ yyres[yyn] = *yyp;
4611+ yyn++;
4612+ break;
4613+
4614+ case '"':
4615+ if (yyres)
4616+ yyres[yyn] = '\0';
4617+ return yyn;
4618+ }
4619+ do_not_strip_quotes:;
4620+ }
4621
4622- if (! yyres)
4623- return yystrlen (yystr);
4624+ if (!yyres)
4625+ return yystrlen(yystr);
4626
4627- return yystpcpy (yyres, yystr) - yyres;
4628+ return yystpcpy(yyres, yystr) - yyres;
4629 }
4630-# endif
4631+#endif
4632
4633 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
4634 about the unexpected token YYTOKEN for the state stack whose top is
4635@@ -922,11 +788,10 @@ yytnamerr (char *yyres, const char *yystr)
4636 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
4637 required number of bytes is too large to store. */
4638 static int
4639-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
4640- yytype_int16 *yyssp, int yytoken)
4641+yysyntax_error(YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken)
4642 {
4643- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
4644- YYSIZE_T yysize = yysize0;
4645+ YYSIZE_T yysize0 = yytnamerr(YY_NULLPTR, yytname[yytoken]);
4646+ YYSIZE_T yysize = yysize0;
4647 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
4648 /* Internationalized format string. */
4649 const char *yyformat = YY_NULLPTR;
4650@@ -959,91 +824,79 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
4651 one exception: it will still contain any token that will not be
4652 accepted due to an error action in a later state.
4653 */
4654- if (yytoken != YYEMPTY)
4655- {
4656- int yyn = yypact[*yyssp];
4657- yyarg[yycount++] = yytname[yytoken];
4658- if (!yypact_value_is_default (yyn))
4659- {
4660- /* Start YYX at -YYN if negative to avoid negative indexes in
4661- YYCHECK. In other words, skip the first -YYN actions for
4662- this state because they are default actions. */
4663- int yyxbegin = yyn < 0 ? -yyn : 0;
4664- /* Stay within bounds of both yycheck and yytname. */
4665- int yychecklim = YYLAST - yyn + 1;
4666- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
4667- int yyx;
4668-
4669- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
4670- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
4671- && !yytable_value_is_error (yytable[yyx + yyn]))
4672- {
4673- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
4674- {
4675- yycount = 1;
4676- yysize = yysize0;
4677- break;
4678- }
4679- yyarg[yycount++] = yytname[yyx];
4680- {
4681- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
4682- if (! (yysize <= yysize1
4683- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
4684- return 2;
4685- yysize = yysize1;
4686- }
4687- }
4688+ if (yytoken != YYEMPTY) {
4689+ int yyn = yypact[*yyssp];
4690+ yyarg[yycount++] = yytname[yytoken];
4691+ if (!yypact_value_is_default(yyn)) {
4692+ /* Start YYX at -YYN if negative to avoid negative indexes in
4693+ YYCHECK. In other words, skip the first -YYN actions for
4694+ this state because they are default actions. */
4695+ int yyxbegin = yyn < 0 ? -yyn : 0;
4696+ /* Stay within bounds of both yycheck and yytname. */
4697+ int yychecklim = YYLAST - yyn + 1;
4698+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
4699+ int yyx;
4700+
4701+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
4702+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error(yytable[yyx + yyn])) {
4703+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) {
4704+ yycount = 1;
4705+ yysize = yysize0;
4706+ break;
4707+ }
4708+ yyarg[yycount++] = yytname[yyx];
4709+ {
4710+ YYSIZE_T yysize1 = yysize + yytnamerr(YY_NULLPTR, yytname[yyx]);
4711+ if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
4712+ return 2;
4713+ yysize = yysize1;
4714+ }
4715 }
4716 }
4717+ }
4718
4719- switch (yycount)
4720- {
4721-# define YYCASE_(N, S) \
4722- case N: \
4723- yyformat = S; \
4724- break
4725- YYCASE_(0, YY_("syntax error"));
4726- YYCASE_(1, YY_("syntax error, unexpected %s"));
4727- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
4728- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
4729- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
4730- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
4731-# undef YYCASE_
4732- }
4733+ switch (yycount) {
4734+#define YYCASE_(N, S) \
4735+ case N: \
4736+ yyformat = S; \
4737+ break
4738+ YYCASE_(0, YY_("syntax error"));
4739+ YYCASE_(1, YY_("syntax error, unexpected %s"));
4740+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
4741+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
4742+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
4743+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
4744+#undef YYCASE_
4745+ }
4746
4747 {
4748- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
4749- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
4750+ YYSIZE_T yysize1 = yysize + yystrlen(yyformat);
4751+ if (!(yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
4752 return 2;
4753 yysize = yysize1;
4754 }
4755
4756- if (*yymsg_alloc < yysize)
4757- {
4758- *yymsg_alloc = 2 * yysize;
4759- if (! (yysize <= *yymsg_alloc
4760- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
4761- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
4762- return 1;
4763- }
4764+ if (*yymsg_alloc < yysize) {
4765+ *yymsg_alloc = 2 * yysize;
4766+ if (!(yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
4767+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
4768+ return 1;
4769+ }
4770
4771 /* Avoid sprintf, as that infringes on the user's name space.
4772 Don't have undefined behavior even if the translation
4773 produced a string with the wrong number of "%s"s. */
4774 {
4775 char *yyp = *yymsg;
4776- int yyi = 0;
4777+ int yyi = 0;
4778 while ((*yyp = *yyformat) != '\0')
4779- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
4780- {
4781- yyp += yytnamerr (yyp, yyarg[yyi++]);
4782- yyformat += 2;
4783- }
4784- else
4785- {
4786- yyp++;
4787- yyformat++;
4788- }
4789+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) {
4790+ yyp += yytnamerr(yyp, yyarg[yyi++]);
4791+ yyformat += 2;
4792+ } else {
4793+ yyp++;
4794+ yyformat++;
4795+ }
4796 }
4797 return 0;
4798 }
4799@@ -1054,65 +907,61 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
4800 `-----------------------------------------------*/
4801
4802 static void
4803-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t lexer, struct TsConfigHandlers* handlers)
4804+yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t lexer, struct TsConfigHandlers *handlers)
4805 {
4806- YYUSE (yyvaluep);
4807- YYUSE (lexer);
4808- YYUSE (handlers);
4809+ YYUSE(yyvaluep);
4810+ YYUSE(lexer);
4811+ YYUSE(handlers);
4812 if (!yymsg)
4813 yymsg = "Deleting";
4814- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
4815+ YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp);
4816
4817 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
4818- YYUSE (yytype);
4819+ YYUSE(yytype);
4820 YY_IGNORE_MAYBE_UNINITIALIZED_END
4821 }
4822
4823-
4824-
4825-
4826 /*----------.
4827 | yyparse. |
4828 `----------*/
4829
4830 int
4831-yyparse (yyscan_t lexer, struct TsConfigHandlers* handlers)
4832+yyparse(yyscan_t lexer, struct TsConfigHandlers *handlers)
4833 {
4834-/* The lookahead symbol. */
4835-int yychar;
4836+ /* The lookahead symbol. */
4837+ int yychar;
4838
4839+ /* The semantic value of the lookahead symbol. */
4840+ /* Default value used for initialization, for pacifying older GCCs
4841+ or non-GCC compilers. */
4842+ YY_INITIAL_VALUE(static YYSTYPE yyval_default;)
4843+ YYSTYPE yylval YY_INITIAL_VALUE(= yyval_default);
4844
4845-/* The semantic value of the lookahead symbol. */
4846-/* Default value used for initialization, for pacifying older GCCs
4847- or non-GCC compilers. */
4848-YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
4849-YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
4850+ /* Number of syntax errors so far. */
4851+ int yynerrs;
4852
4853- /* Number of syntax errors so far. */
4854- int yynerrs;
4855+ int yystate;
4856+ /* Number of tokens to shift before error messages enabled. */
4857+ int yyerrstatus;
4858
4859- int yystate;
4860- /* Number of tokens to shift before error messages enabled. */
4861- int yyerrstatus;
4862+ /* The stacks and their tools:
4863+ 'yyss': related to states.
4864+ 'yyvs': related to semantic values.
4865
4866- /* The stacks and their tools:
4867- 'yyss': related to states.
4868- 'yyvs': related to semantic values.
4869+ Refer to the stacks through separate pointers, to allow yyoverflow
4870+ to reallocate them elsewhere. */
4871
4872- Refer to the stacks through separate pointers, to allow yyoverflow
4873- to reallocate them elsewhere. */
4874+ /* The state stack. */
4875+ yytype_int16 yyssa[YYINITDEPTH];
4876+ yytype_int16 *yyss;
4877+ yytype_int16 *yyssp;
4878
4879- /* The state stack. */
4880- yytype_int16 yyssa[YYINITDEPTH];
4881- yytype_int16 *yyss;
4882- yytype_int16 *yyssp;
4883+ /* The semantic value stack. */
4884+ YYSTYPE yyvsa[YYINITDEPTH];
4885+ YYSTYPE *yyvs;
4886+ YYSTYPE *yyvsp;
4887
4888- /* The semantic value stack. */
4889- YYSTYPE yyvsa[YYINITDEPTH];
4890- YYSTYPE *yyvs;
4891- YYSTYPE *yyvsp;
4892-
4893- YYSIZE_T yystacksize;
4894+ YYSIZE_T yystacksize;
4895
4896 int yyn;
4897 int yyresult;
4898@@ -1125,11 +974,11 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
4899 #if YYERROR_VERBOSE
4900 /* Buffer for error messages, and its allocated size. */
4901 char yymsgbuf[128];
4902- char *yymsg = yymsgbuf;
4903+ char *yymsg = yymsgbuf;
4904 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
4905 #endif
4906
4907-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
4908+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
4909
4910 /* The number of symbols on the RHS of the reduced rule.
4911 Keep to zero when no symbol should be popped. */
4912@@ -1137,89 +986,83 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
4913
4914 yyssp = yyss = yyssa;
4915 yyvsp = yyvs = yyvsa;
4916- yystacksize = YYINITDEPTH;
4917+ yystacksize = YYINITDEPTH;
4918
4919- YYDPRINTF ((stderr, "Starting parse\n"));
4920+ YYDPRINTF((stderr, "Starting parse\n"));
4921
4922- yystate = 0;
4923+ yystate = 0;
4924 yyerrstatus = 0;
4925- yynerrs = 0;
4926- yychar = YYEMPTY; /* Cause a token to be read. */
4927+ yynerrs = 0;
4928+ yychar = YYEMPTY; /* Cause a token to be read. */
4929 goto yysetstate;
4930
4931-/*------------------------------------------------------------.
4932-| yynewstate -- Push a new state, which is found in yystate. |
4933-`------------------------------------------------------------*/
4934- yynewstate:
4935+ /*------------------------------------------------------------.
4936+ | yynewstate -- Push a new state, which is found in yystate. |
4937+ `------------------------------------------------------------*/
4938+yynewstate:
4939 /* In all cases, when you get here, the value and location stacks
4940 have just been pushed. So pushing a state here evens the stacks. */
4941 yyssp++;
4942
4943- yysetstate:
4944+yysetstate:
4945 *yyssp = yystate;
4946
4947- if (yyss + yystacksize - 1 <= yyssp)
4948- {
4949- /* Get the current used size of the three stacks, in elements. */
4950- YYSIZE_T yysize = yyssp - yyss + 1;
4951+ if (yyss + yystacksize - 1 <= yyssp) {
4952+ /* Get the current used size of the three stacks, in elements. */
4953+ YYSIZE_T yysize = yyssp - yyss + 1;
4954
4955 #ifdef yyoverflow
4956- {
4957- /* Give user a chance to reallocate the stack. Use copies of
4958- these so that the &'s don't force the real ones into
4959- memory. */
4960- YYSTYPE *yyvs1 = yyvs;
4961- yytype_int16 *yyss1 = yyss;
4962-
4963- /* Each stack pointer address is followed by the size of the
4964- data in use in that stack, in bytes. This used to be a
4965- conditional around just the two extra args, but that might
4966- be undefined if yyoverflow is a macro. */
4967- yyoverflow (YY_("memory exhausted"),
4968- &yyss1, yysize * sizeof (*yyssp),
4969- &yyvs1, yysize * sizeof (*yyvsp),
4970- &yystacksize);
4971-
4972- yyss = yyss1;
4973- yyvs = yyvs1;
4974- }
4975+ {
4976+ /* Give user a chance to reallocate the stack. Use copies of
4977+ these so that the &'s don't force the real ones into
4978+ memory. */
4979+ YYSTYPE *yyvs1 = yyvs;
4980+ yytype_int16 *yyss1 = yyss;
4981+
4982+ /* Each stack pointer address is followed by the size of the
4983+ data in use in that stack, in bytes. This used to be a
4984+ conditional around just the two extra args, but that might
4985+ be undefined if yyoverflow is a macro. */
4986+ yyoverflow(YY_("memory exhausted"), &yyss1, yysize * sizeof(*yyssp), &yyvs1, yysize * sizeof(*yyvsp), &yystacksize);
4987+
4988+ yyss = yyss1;
4989+ yyvs = yyvs1;
4990+ }
4991 #else /* no yyoverflow */
4992-# ifndef YYSTACK_RELOCATE
4993+#ifndef YYSTACK_RELOCATE
4994+ goto yyexhaustedlab;
4995+#else
4996+ /* Extend the stack our own way. */
4997+ if (YYMAXDEPTH <= yystacksize)
4998 goto yyexhaustedlab;
4999-# else
5000- /* Extend the stack our own way. */
5001- if (YYMAXDEPTH <= yystacksize)
5002+ yystacksize *= 2;
5003+ if (YYMAXDEPTH < yystacksize)
5004+ yystacksize = YYMAXDEPTH;
5005+
5006+ {
5007+ yytype_int16 *yyss1 = yyss;
5008+ union yyalloc *yyptr = (union yyalloc *)YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize));
5009+ if (!yyptr)
5010 goto yyexhaustedlab;
5011- yystacksize *= 2;
5012- if (YYMAXDEPTH < yystacksize)
5013- yystacksize = YYMAXDEPTH;
5014-
5015- {
5016- yytype_int16 *yyss1 = yyss;
5017- union yyalloc *yyptr =
5018- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
5019- if (! yyptr)
5020- goto yyexhaustedlab;
5021- YYSTACK_RELOCATE (yyss_alloc, yyss);
5022- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
5023-# undef YYSTACK_RELOCATE
5024- if (yyss1 != yyssa)
5025- YYSTACK_FREE (yyss1);
5026- }
5027-# endif
5028+ YYSTACK_RELOCATE(yyss_alloc, yyss);
5029+ YYSTACK_RELOCATE(yyvs_alloc, yyvs);
5030+#undef YYSTACK_RELOCATE
5031+ if (yyss1 != yyssa)
5032+ YYSTACK_FREE(yyss1);
5033+ }
5034+#endif
5035 #endif /* no yyoverflow */
5036
5037- yyssp = yyss + yysize - 1;
5038- yyvsp = yyvs + yysize - 1;
5039+ yyssp = yyss + yysize - 1;
5040+ yyvsp = yyvs + yysize - 1;
5041
5042- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
5043- (unsigned long int) yystacksize));
5044+ YYDPRINTF((stderr, "Stack size increased to %lu\n", (unsigned long int)yystacksize));
5045
5046- if (yyss + yystacksize - 1 <= yyssp)
5047- YYABORT;
5048- }
5049+ if (yyss + yystacksize - 1 <= yyssp)
5050+ YYABORT;
5051+ }
5052
5053- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
5054+ YYDPRINTF((stderr, "Entering state %d\n", yystate));
5055
5056 if (yystate == YYFINAL)
5057 YYACCEPT;
5058@@ -1236,28 +1079,24 @@ yybackup:
5059
5060 /* First try to decide what to do without reference to lookahead token. */
5061 yyn = yypact[yystate];
5062- if (yypact_value_is_default (yyn))
5063+ if (yypact_value_is_default(yyn))
5064 goto yydefault;
5065
5066 /* Not known => get a lookahead token if don't already have one. */
5067
5068 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
5069- if (yychar == YYEMPTY)
5070- {
5071- YYDPRINTF ((stderr, "Reading a token: "));
5072- yychar = yylex (&yylval, lexer);
5073- }
5074+ if (yychar == YYEMPTY) {
5075+ YYDPRINTF((stderr, "Reading a token: "));
5076+ yychar = yylex(&yylval, lexer);
5077+ }
5078
5079- if (yychar <= YYEOF)
5080- {
5081- yychar = yytoken = YYEOF;
5082- YYDPRINTF ((stderr, "Now at end of input.\n"));
5083- }
5084- else
5085- {
5086- yytoken = YYTRANSLATE (yychar);
5087- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
5088- }
5089+ if (yychar <= YYEOF) {
5090+ yychar = yytoken = YYEOF;
5091+ YYDPRINTF((stderr, "Now at end of input.\n"));
5092+ } else {
5093+ yytoken = YYTRANSLATE(yychar);
5094+ YY_SYMBOL_PRINT("Next token is", yytoken, &yylval, &yylloc);
5095+ }
5096
5097 /* If the proper action on seeing token YYTOKEN is to reduce or to
5098 detect an error, take that action. */
5099@@ -1265,13 +1104,12 @@ yybackup:
5100 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
5101 goto yydefault;
5102 yyn = yytable[yyn];
5103- if (yyn <= 0)
5104- {
5105- if (yytable_value_is_error (yyn))
5106- goto yyerrlab;
5107- yyn = -yyn;
5108- goto yyreduce;
5109- }
5110+ if (yyn <= 0) {
5111+ if (yytable_value_is_error(yyn))
5112+ goto yyerrlab;
5113+ yyn = -yyn;
5114+ goto yyreduce;
5115+ }
5116
5117 /* Count tokens shifted since error; after three, turn off error
5118 status. */
5119@@ -1279,7 +1117,7 @@ yybackup:
5120 yyerrstatus--;
5121
5122 /* Shift the lookahead token. */
5123- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
5124+ YY_SYMBOL_PRINT("Shifting", yytoken, &yylval, &yylloc);
5125
5126 /* Discard the shifted token. */
5127 yychar = YYEMPTY;
5128@@ -1291,7 +1129,6 @@ yybackup:
5129
5130 goto yynewstate;
5131
5132-
5133 /*-----------------------------------------------------------.
5134 | yydefault -- do the default action for the current state. |
5135 `-----------------------------------------------------------*/
5136@@ -1301,7 +1138,6 @@ yydefault:
5137 goto yyerrlab;
5138 goto yyreduce;
5139
5140-
5141 /*-----------------------------.
5142 | yyreduce -- Do a reduction. |
5143 `-----------------------------*/
5144@@ -1317,76 +1153,94 @@ yyreduce:
5145 users should not rely upon it. Assigning to YYVAL
5146 unconditionally makes the parser a bit smaller, and it avoids a
5147 GCC warning that YYVAL may be used uninitialized. */
5148- yyval = yyvsp[1-yylen];
5149+ yyval = yyvsp[1 - yylen];
5150
5151-
5152- YY_REDUCE_PRINT (yyn);
5153- switch (yyn)
5154- {
5155- case 4:
5156+ YY_REDUCE_PRINT(yyn);
5157+ switch (yyn) {
5158+ case 4:
5159 #line 90 "TsConfigGrammar.y" /* yacc.c:1646 */
5160- { HANDLE_EVENT(GroupOpen, (yyvsp[0])); }
5161+ {
5162+ HANDLE_EVENT(GroupOpen, (yyvsp[0]));
5163+ }
5164 #line 1330 "TsConfigGrammar.c" /* yacc.c:1646 */
5165- break;
5166+ break;
5167
5168 case 5:
5169 #line 92 "TsConfigGrammar.y" /* yacc.c:1646 */
5170- { HANDLE_EVENT(GroupClose, (yyvsp[0])); }
5171+ {
5172+ HANDLE_EVENT(GroupClose, (yyvsp[0]));
5173+ }
5174 #line 1336 "TsConfigGrammar.c" /* yacc.c:1646 */
5175- break;
5176+ break;
5177
5178 case 9:
5179 #line 96 "TsConfigGrammar.y" /* yacc.c:1646 */
5180- { HANDLE_EVENT(GroupName, (yyvsp[-1])); }
5181+ {
5182+ HANDLE_EVENT(GroupName, (yyvsp[-1]));
5183+ }
5184 #line 1342 "TsConfigGrammar.c" /* yacc.c:1646 */
5185- break;
5186+ break;
5187
5188 case 12:
5189 #line 100 "TsConfigGrammar.y" /* yacc.c:1646 */
5190- { HANDLE_EVENT(ListOpen, (yyvsp[0])); }
5191+ {
5192+ HANDLE_EVENT(ListOpen, (yyvsp[0]));
5193+ }
5194 #line 1348 "TsConfigGrammar.c" /* yacc.c:1646 */
5195- break;
5196+ break;
5197
5198 case 13:
5199 #line 102 "TsConfigGrammar.y" /* yacc.c:1646 */
5200- { HANDLE_EVENT(ListClose, (yyvsp[0])); }
5201+ {
5202+ HANDLE_EVENT(ListClose, (yyvsp[0]));
5203+ }
5204 #line 1354 "TsConfigGrammar.c" /* yacc.c:1646 */
5205- break;
5206+ break;
5207
5208 case 17:
5209 #line 106 "TsConfigGrammar.y" /* yacc.c:1646 */
5210- { HANDLE_EVENT(LiteralValue, (yyvsp[0])); }
5211+ {
5212+ HANDLE_EVENT(LiteralValue, (yyvsp[0]));
5213+ }
5214 #line 1360 "TsConfigGrammar.c" /* yacc.c:1646 */
5215- break;
5216+ break;
5217
5218 case 27:
5219 #line 114 "TsConfigGrammar.y" /* yacc.c:1646 */
5220- { HANDLE_EVENT(PathOpen, (yyvsp[0])); }
5221+ {
5222+ HANDLE_EVENT(PathOpen, (yyvsp[0]));
5223+ }
5224 #line 1366 "TsConfigGrammar.c" /* yacc.c:1646 */
5225- break;
5226+ break;
5227
5228 case 28:
5229 #line 116 "TsConfigGrammar.y" /* yacc.c:1646 */
5230- { HANDLE_EVENT(PathClose, (yyvsp[0])); }
5231+ {
5232+ HANDLE_EVENT(PathClose, (yyvsp[0]));
5233+ }
5234 #line 1372 "TsConfigGrammar.c" /* yacc.c:1646 */
5235- break;
5236+ break;
5237
5238 case 31:
5239 #line 120 "TsConfigGrammar.y" /* yacc.c:1646 */
5240- { HANDLE_EVENT(PathTag, (yyvsp[0])); }
5241+ {
5242+ HANDLE_EVENT(PathTag, (yyvsp[0]));
5243+ }
5244 #line 1378 "TsConfigGrammar.c" /* yacc.c:1646 */
5245- break;
5246+ break;
5247
5248 case 32:
5249 #line 120 "TsConfigGrammar.y" /* yacc.c:1646 */
5250- { HANDLE_EVENT(PathIndex, (yyvsp[0])); }
5251+ {
5252+ HANDLE_EVENT(PathIndex, (yyvsp[0]));
5253+ }
5254 #line 1384 "TsConfigGrammar.c" /* yacc.c:1646 */
5255- break;
5256-
5257+ break;
5258
5259 #line 1388 "TsConfigGrammar.c" /* yacc.c:1646 */
5260- default: break;
5261- }
5262+ default:
5263+ break;
5264+ }
5265 /* User semantic actions sometimes alter yychar, and that requires
5266 that yytoken be updated with the new translation. We take the
5267 approach of translating immediately before every use of yytoken.
5268@@ -1398,11 +1252,11 @@ yyreduce:
5269 case of YYERROR or YYBACKUP, subsequent parser actions might lead
5270 to an incorrect destructor call or verbose syntax error message
5271 before the lookahead is translated. */
5272- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
5273+ YY_SYMBOL_PRINT("-> $$ =", yyr1[yyn], &yyval, &yyloc);
5274
5275- YYPOPSTACK (yylen);
5276+ YYPOPSTACK(yylen);
5277 yylen = 0;
5278- YY_STACK_PRINT (yyss, yyssp);
5279+ YY_STACK_PRINT(yyss, yyssp);
5280
5281 *++yyvsp = yyval;
5282
5283@@ -1420,81 +1274,66 @@ yyreduce:
5284
5285 goto yynewstate;
5286
5287-
5288 /*--------------------------------------.
5289 | yyerrlab -- here on detecting error. |
5290 `--------------------------------------*/
5291 yyerrlab:
5292 /* Make sure we have latest lookahead translation. See comments at
5293 user semantic actions for why this is necessary. */
5294- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
5295+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE(yychar);
5296
5297 /* If not already recovering from an error, report this error. */
5298- if (!yyerrstatus)
5299- {
5300- ++yynerrs;
5301-#if ! YYERROR_VERBOSE
5302- yyerror (lexer, handlers, YY_("syntax error"));
5303+ if (!yyerrstatus) {
5304+ ++yynerrs;
5305+#if !YYERROR_VERBOSE
5306+ yyerror(lexer, handlers, YY_("syntax error"));
5307 #else
5308-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
5309- yyssp, yytoken)
5310- {
5311- char const *yymsgp = YY_("syntax error");
5312- int yysyntax_error_status;
5313- yysyntax_error_status = YYSYNTAX_ERROR;
5314- if (yysyntax_error_status == 0)
5315- yymsgp = yymsg;
5316- else if (yysyntax_error_status == 1)
5317- {
5318- if (yymsg != yymsgbuf)
5319- YYSTACK_FREE (yymsg);
5320- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
5321- if (!yymsg)
5322- {
5323- yymsg = yymsgbuf;
5324- yymsg_alloc = sizeof yymsgbuf;
5325- yysyntax_error_status = 2;
5326- }
5327- else
5328- {
5329- yysyntax_error_status = YYSYNTAX_ERROR;
5330- yymsgp = yymsg;
5331- }
5332- }
5333- yyerror (lexer, handlers, yymsgp);
5334- if (yysyntax_error_status == 2)
5335- goto yyexhaustedlab;
5336+#define YYSYNTAX_ERROR yysyntax_error(&yymsg_alloc, &yymsg, yyssp, yytoken)
5337+ {
5338+ char const *yymsgp = YY_("syntax error");
5339+ int yysyntax_error_status;
5340+ yysyntax_error_status = YYSYNTAX_ERROR;
5341+ if (yysyntax_error_status == 0)
5342+ yymsgp = yymsg;
5343+ else if (yysyntax_error_status == 1) {
5344+ if (yymsg != yymsgbuf)
5345+ YYSTACK_FREE(yymsg);
5346+ yymsg = (char *)YYSTACK_ALLOC(yymsg_alloc);
5347+ if (!yymsg) {
5348+ yymsg = yymsgbuf;
5349+ yymsg_alloc = sizeof yymsgbuf;
5350+ yysyntax_error_status = 2;
5351+ } else {
5352+ yysyntax_error_status = YYSYNTAX_ERROR;
5353+ yymsgp = yymsg;
5354+ }
5355 }
5356-# undef YYSYNTAX_ERROR
5357-#endif
5358+ yyerror(lexer, handlers, yymsgp);
5359+ if (yysyntax_error_status == 2)
5360+ goto yyexhaustedlab;
5361 }
5362+#undef YYSYNTAX_ERROR
5363+#endif
5364+ }
5365
5366+ if (yyerrstatus == 3) {
5367+ /* If just tried and failed to reuse lookahead token after an
5368+ error, discard it. */
5369
5370-
5371- if (yyerrstatus == 3)
5372- {
5373- /* If just tried and failed to reuse lookahead token after an
5374- error, discard it. */
5375-
5376- if (yychar <= YYEOF)
5377- {
5378- /* Return failure if at end of input. */
5379- if (yychar == YYEOF)
5380- YYABORT;
5381- }
5382- else
5383- {
5384- yydestruct ("Error: discarding",
5385- yytoken, &yylval, lexer, handlers);
5386- yychar = YYEMPTY;
5387- }
5388+ if (yychar <= YYEOF) {
5389+ /* Return failure if at end of input. */
5390+ if (yychar == YYEOF)
5391+ YYABORT;
5392+ } else {
5393+ yydestruct("Error: discarding", yytoken, &yylval, lexer, handlers);
5394+ yychar = YYEMPTY;
5395 }
5396+ }
5397
5398 /* Else will try to reuse lookahead token after shifting the error
5399 token. */
5400 goto yyerrlab1;
5401
5402-
5403 /*---------------------------------------------------.
5404 | yyerrorlab -- error raised explicitly by YYERROR. |
5405 `---------------------------------------------------*/
5406@@ -1504,61 +1343,53 @@ yyerrorlab:
5407 YYERROR and the label yyerrorlab therefore never appears in user
5408 code. */
5409 if (/*CONSTCOND*/ 0)
5410- goto yyerrorlab;
5411+ goto yyerrorlab;
5412
5413 /* Do not reclaim the symbols of the rule whose action triggered
5414 this YYERROR. */
5415- YYPOPSTACK (yylen);
5416+ YYPOPSTACK(yylen);
5417 yylen = 0;
5418- YY_STACK_PRINT (yyss, yyssp);
5419+ YY_STACK_PRINT(yyss, yyssp);
5420 yystate = *yyssp;
5421 goto yyerrlab1;
5422
5423-
5424 /*-------------------------------------------------------------.
5425 | yyerrlab1 -- common code for both syntax error and YYERROR. |
5426 `-------------------------------------------------------------*/
5427 yyerrlab1:
5428- yyerrstatus = 3; /* Each real token shifted decrements this. */
5429-
5430- for (;;)
5431- {
5432- yyn = yypact[yystate];
5433- if (!yypact_value_is_default (yyn))
5434- {
5435- yyn += YYTERROR;
5436- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
5437- {
5438- yyn = yytable[yyn];
5439- if (0 < yyn)
5440- break;
5441- }
5442- }
5443-
5444- /* Pop the current state because it cannot handle the error token. */
5445- if (yyssp == yyss)
5446- YYABORT;
5447+ yyerrstatus = 3; /* Each real token shifted decrements this. */
5448+
5449+ for (;;) {
5450+ yyn = yypact[yystate];
5451+ if (!yypact_value_is_default(yyn)) {
5452+ yyn += YYTERROR;
5453+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) {
5454+ yyn = yytable[yyn];
5455+ if (0 < yyn)
5456+ break;
5457+ }
5458+ }
5459
5460+ /* Pop the current state because it cannot handle the error token. */
5461+ if (yyssp == yyss)
5462+ YYABORT;
5463
5464- yydestruct ("Error: popping",
5465- yystos[yystate], yyvsp, lexer, handlers);
5466- YYPOPSTACK (1);
5467- yystate = *yyssp;
5468- YY_STACK_PRINT (yyss, yyssp);
5469- }
5470+ yydestruct("Error: popping", yystos[yystate], yyvsp, lexer, handlers);
5471+ YYPOPSTACK(1);
5472+ yystate = *yyssp;
5473+ YY_STACK_PRINT(yyss, yyssp);
5474+ }
5475
5476 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
5477 *++yyvsp = yylval;
5478 YY_IGNORE_MAYBE_UNINITIALIZED_END
5479
5480-
5481 /* Shift the error token. */
5482- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
5483+ YY_SYMBOL_PRINT("Shifting", yystos[yyn], yyvsp, yylsp);
5484
5485 yystate = yyn;
5486 goto yynewstate;
5487
5488-
5489 /*-------------------------------------.
5490 | yyacceptlab -- YYACCEPT comes here. |
5491 `-------------------------------------*/
5492@@ -1578,41 +1409,36 @@ yyabortlab:
5493 | yyexhaustedlab -- memory exhaustion comes here. |
5494 `-------------------------------------------------*/
5495 yyexhaustedlab:
5496- yyerror (lexer, handlers, YY_("memory exhausted"));
5497+ yyerror(lexer, handlers, YY_("memory exhausted"));
5498 yyresult = 2;
5499 /* Fall through. */
5500 #endif
5501
5502 yyreturn:
5503- if (yychar != YYEMPTY)
5504- {
5505- /* Make sure we have latest lookahead translation. See comments at
5506- user semantic actions for why this is necessary. */
5507- yytoken = YYTRANSLATE (yychar);
5508- yydestruct ("Cleanup: discarding lookahead",
5509- yytoken, &yylval, lexer, handlers);
5510- }
5511+ if (yychar != YYEMPTY) {
5512+ /* Make sure we have latest lookahead translation. See comments at
5513+ user semantic actions for why this is necessary. */
5514+ yytoken = YYTRANSLATE(yychar);
5515+ yydestruct("Cleanup: discarding lookahead", yytoken, &yylval, lexer, handlers);
5516+ }
5517 /* Do not reclaim the symbols of the rule whose action triggered
5518 this YYABORT or YYACCEPT. */
5519- YYPOPSTACK (yylen);
5520- YY_STACK_PRINT (yyss, yyssp);
5521- while (yyssp != yyss)
5522- {
5523- yydestruct ("Cleanup: popping",
5524- yystos[*yyssp], yyvsp, lexer, handlers);
5525- YYPOPSTACK (1);
5526- }
5527+ YYPOPSTACK(yylen);
5528+ YY_STACK_PRINT(yyss, yyssp);
5529+ while (yyssp != yyss) {
5530+ yydestruct("Cleanup: popping", yystos[*yyssp], yyvsp, lexer, handlers);
5531+ YYPOPSTACK(1);
5532+ }
5533 #ifndef yyoverflow
5534 if (yyss != yyssa)
5535- YYSTACK_FREE (yyss);
5536+ YYSTACK_FREE(yyss);
5537 #endif
5538 #if YYERROR_VERBOSE
5539 if (yymsg != yymsgbuf)
5540- YYSTACK_FREE (yymsg);
5541+ YYSTACK_FREE(yymsg);
5542 #endif
5543 return yyresult;
5544 }
5545 #line 122 "TsConfigGrammar.y" /* yacc.c:1906 */
5546
5547-
5548-# endif // __clang_analyzer__
5549+#endif // __clang_analyzer__
5550diff --git a/lib/tsconfig/TsConfigGrammar.h b/lib/tsconfig/TsConfigGrammar.h
5551index 4d98d3ad2..7e801857f 100644
5552--- a/lib/tsconfig/TsConfigGrammar.h
5553+++ b/lib/tsconfig/TsConfigGrammar.h
5554@@ -31,10 +31,10 @@
5555 version 2.2 of Bison. */
5556
5557 #ifndef YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED
5558-# define YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED
5559+#define YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED
5560 /* Debug traces. */
5561 #ifndef YYDEBUG
5562-# define YYDEBUG 0
5563+#define YYDEBUG 0
5564 #endif
5565 #if YYDEBUG
5566 extern int tsconfigdebug;
5567@@ -69,22 +69,21 @@ extern int tsconfigdebug;
5568
5569 /* Token type. */
5570 #ifndef YYTOKENTYPE
5571-# define YYTOKENTYPE
5572- enum yytokentype
5573- {
5574- STRING = 258,
5575- IDENT = 259,
5576- INTEGER = 260,
5577- LIST_OPEN = 261,
5578- LIST_CLOSE = 262,
5579- GROUP_OPEN = 263,
5580- GROUP_CLOSE = 264,
5581- PATH_OPEN = 265,
5582- PATH_CLOSE = 266,
5583- PATH_SEPARATOR = 267,
5584- SEPARATOR = 268,
5585- ASSIGN = 269
5586- };
5587+#define YYTOKENTYPE
5588+enum yytokentype {
5589+ STRING = 258,
5590+ IDENT = 259,
5591+ INTEGER = 260,
5592+ LIST_OPEN = 261,
5593+ LIST_CLOSE = 262,
5594+ GROUP_OPEN = 263,
5595+ GROUP_CLOSE = 264,
5596+ PATH_OPEN = 265,
5597+ PATH_CLOSE = 266,
5598+ PATH_SEPARATOR = 267,
5599+ SEPARATOR = 268,
5600+ ASSIGN = 269
5601+};
5602 #endif
5603 /* Tokens. */
5604 #define STRING 258
5605@@ -101,14 +100,12 @@ extern int tsconfigdebug;
5606 #define ASSIGN 269
5607
5608 /* Value type. */
5609-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
5610+#if !defined YYSTYPE && !defined YYSTYPE_IS_DECLARED
5611 typedef int YYSTYPE;
5612-# define YYSTYPE_IS_TRIVIAL 1
5613-# define YYSTYPE_IS_DECLARED 1
5614+#define YYSTYPE_IS_TRIVIAL 1
5615+#define YYSTYPE_IS_DECLARED 1
5616 #endif
5617
5618-
5619-
5620-int tsconfigparse (yyscan_t lexer, struct TsConfigHandlers* handlers);
5621+int tsconfigparse(yyscan_t lexer, struct TsConfigHandlers *handlers);
5622
5623 #endif /* !YY_TSCONFIG_TSCONFIGGRAMMAR_H_INCLUDED */
5624diff --git a/lib/tsconfig/TsConfigLexer.h b/lib/tsconfig/TsConfigLexer.h
5625index 40262ed68..5282e08f3 100644
5626--- a/lib/tsconfig/TsConfigLexer.h
5627+++ b/lib/tsconfig/TsConfigLexer.h
5628@@ -21,14 +21,14 @@
5629 limitations under the License.
5630 */
5631
5632-# if ! defined(TS_CONFIG_LEXER_HEADER)
5633-# define TS_CONFIG_LEXER_HEADER
5634+#if !defined(TS_CONFIG_LEXER_HEADER)
5635+#define TS_CONFIG_LEXER_HEADER
5636
5637 struct TsConfigHandlers; // forward declare.
5638
5639-# if defined(__cplusplus)
5640- extern "C" {
5641-# endif
5642+#if defined(__cplusplus)
5643+extern "C" {
5644+#endif
5645
5646 /// Get the current line in the buffer during parsing.
5647 /// @return 1 based line number.
5648@@ -48,14 +48,13 @@ extern int tsconfiglex_current_col(void);
5649
5650 @return Not sure.
5651 */
5652-extern int tsconfig_parse_buffer(
5653- struct TsConfigHandlers* handlers, ///< Syntax handlers.
5654- char* buffer, ///< Input buffer.
5655- size_t buffer_len ///< Length of input buffer.
5656+extern int tsconfig_parse_buffer(struct TsConfigHandlers *handlers, ///< Syntax handlers.
5657+ char *buffer, ///< Input buffer.
5658+ size_t buffer_len ///< Length of input buffer.
5659 );
5660
5661-# if defined(__cplusplus)
5662+#if defined(__cplusplus)
5663 }
5664-# endif
5665+#endif
5666
5667-# endif // TS_CONFIG_LEXER_HEADER
5668+#endif // TS_CONFIG_LEXER_HEADER
5669diff --git a/lib/tsconfig/TsConfigParseEvents.h b/lib/tsconfig/TsConfigParseEvents.h
5670index 237514b3e..f70b8f0a4 100644
5671--- a/lib/tsconfig/TsConfigParseEvents.h
5672+++ b/lib/tsconfig/TsConfigParseEvents.h
5673@@ -1,5 +1,5 @@
5674-# if ! defined(TS_CONFIG_PARSE_EVENTS_HEADER)
5675-# define TS_CONFIG_PARSE_EVENTS_HEADER
5676+#if !defined(TS_CONFIG_PARSE_EVENTS_HEADER)
5677+#define TS_CONFIG_PARSE_EVENTS_HEADER
5678
5679 /** @file
5680
5681@@ -24,44 +24,44 @@
5682 limitations under the License.
5683 */
5684
5685-# include "TsConfigTypes.h"
5686+#include "TsConfigTypes.h"
5687
5688-typedef void (*TsConfigEventFunction)(void* data, YYSTYPE* token);
5689+typedef void (*TsConfigEventFunction)(void *data, YYSTYPE *token);
5690 struct TsConfigEventHandler {
5691- TsConfigEventFunction _f; ///< Callback function.
5692- void* _data; ///< Callback context data.
5693+ TsConfigEventFunction _f; ///< Callback function.
5694+ void *_data; ///< Callback context data.
5695 };
5696-typedef int (*TsConfigErrorFunction)(void* data, char const* text);
5697+typedef int (*TsConfigErrorFunction)(void *data, char const *text);
5698 struct TsConfigErrorHandler {
5699- TsConfigErrorFunction _f; ///< Callback function.
5700- void* _data; ///< Callback context data.
5701+ TsConfigErrorFunction _f; ///< Callback function.
5702+ void *_data; ///< Callback context data.
5703 };
5704
5705 enum TsConfigEventType {
5706- TsConfigEventGroupOpen,
5707- TsConfigEventGroupName,
5708- TsConfigEventGroupClose,
5709- TsConfigEventListOpen,
5710- TsConfigEventListClose,
5711- TsConfigEventPathOpen,
5712- TsConfigEventPathTag,
5713- TsConfigEventPathIndex,
5714- TsConfigEventPathClose,
5715- TsConfigEventLiteralValue,
5716- TsConfigEventInvalidToken
5717+ TsConfigEventGroupOpen,
5718+ TsConfigEventGroupName,
5719+ TsConfigEventGroupClose,
5720+ TsConfigEventListOpen,
5721+ TsConfigEventListClose,
5722+ TsConfigEventPathOpen,
5723+ TsConfigEventPathTag,
5724+ TsConfigEventPathIndex,
5725+ TsConfigEventPathClose,
5726+ TsConfigEventLiteralValue,
5727+ TsConfigEventInvalidToken
5728 };
5729
5730-# if defined(__cplusplus)
5731+#if defined(__cplusplus)
5732 static const size_t TS_CONFIG_N_EVENT_TYPES = TsConfigEventInvalidToken + 1;
5733-# else
5734-# define TS_CONFIG_N_EVENT_TYPES (TsConfigEventInvalidToken + 1)
5735-# endif
5736+#else
5737+#define TS_CONFIG_N_EVENT_TYPES (TsConfigEventInvalidToken + 1)
5738+#endif
5739
5740 struct TsConfigHandlers {
5741- struct TsConfigErrorHandler error; ///< Syntax error.
5742- /// Parsing event handlers.
5743- /// Indexed by @c TsConfigEventType.
5744- struct TsConfigEventHandler handler[TS_CONFIG_N_EVENT_TYPES];
5745+ struct TsConfigErrorHandler error; ///< Syntax error.
5746+ /// Parsing event handlers.
5747+ /// Indexed by @c TsConfigEventType.
5748+ struct TsConfigEventHandler handler[TS_CONFIG_N_EVENT_TYPES];
5749 };
5750
5751-# endif // TS_CONFIG_PARSE_EVENTS_HEADER
5752+#endif // TS_CONFIG_PARSE_EVENTS_HEADER
5753diff --git a/lib/tsconfig/TsConfigSyntax.c b/lib/tsconfig/TsConfigSyntax.c
5754index 88764310f..7b9409da9 100644
5755--- a/lib/tsconfig/TsConfigSyntax.c
5756+++ b/lib/tsconfig/TsConfigSyntax.c
5757@@ -2,7 +2,7 @@
5758
5759 #line 4 "TsConfigSyntax.c"
5760
5761-#define YY_INT_ALIGNED short int
5762+#define YY_INT_ALIGNED short int
5763
5764 /* A lexical scanner generated by flex */
5765
5766@@ -31,7 +31,7 @@
5767
5768 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
5769
5770-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
5771+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
5772
5773 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
5774 * if you want the limit (max/min) macros for int types.
5775@@ -57,31 +57,31 @@ typedef unsigned int flex_uint32_t;
5776
5777 /* Limits of integral types. */
5778 #ifndef INT8_MIN
5779-#define INT8_MIN (-128)
5780+#define INT8_MIN (-128)
5781 #endif
5782 #ifndef INT16_MIN
5783-#define INT16_MIN (-32767-1)
5784+#define INT16_MIN (-32767 - 1)
5785 #endif
5786 #ifndef INT32_MIN
5787-#define INT32_MIN (-2147483647-1)
5788+#define INT32_MIN (-2147483647 - 1)
5789 #endif
5790 #ifndef INT8_MAX
5791-#define INT8_MAX (127)
5792+#define INT8_MAX (127)
5793 #endif
5794 #ifndef INT16_MAX
5795-#define INT16_MAX (32767)
5796+#define INT16_MAX (32767)
5797 #endif
5798 #ifndef INT32_MAX
5799-#define INT32_MAX (2147483647)
5800+#define INT32_MAX (2147483647)
5801 #endif
5802 #ifndef UINT8_MAX
5803-#define UINT8_MAX (255U)
5804+#define UINT8_MAX (255U)
5805 #endif
5806 #ifndef UINT16_MAX
5807-#define UINT16_MAX (65535U)
5808+#define UINT16_MAX (65535U)
5809 #endif
5810 #ifndef UINT32_MAX
5811-#define UINT32_MAX (4294967295U)
5812+#define UINT32_MAX (4294967295U)
5813 #endif
5814
5815 #endif /* ! C99 */
5816@@ -93,15 +93,15 @@ typedef unsigned int flex_uint32_t;
5817 /* The "const" storage-class-modifier is valid. */
5818 #define YY_USE_CONST
5819
5820-#else /* ! __cplusplus */
5821+#else /* ! __cplusplus */
5822
5823 /* C99 requires __STDC__ to be defined as 1. */
5824-#if defined (__STDC__)
5825+#if defined(__STDC__)
5826
5827 #define YY_USE_CONST
5828
5829-#endif /* defined (__STDC__) */
5830-#endif /* ! __cplusplus */
5831+#endif /* defined (__STDC__) */
5832+#endif /* ! __cplusplus */
5833
5834 #ifdef YY_USE_CONST
5835 #define yyconst const
5836@@ -117,12 +117,12 @@ typedef unsigned int flex_uint32_t;
5837 * we want to instead treat it as an 8-bit unsigned char, hence the
5838 * double cast.
5839 */
5840-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
5841+#define YY_SC_TO_UI(c) ((unsigned int)(unsigned char)c)
5842
5843 /* An opaque pointer. */
5844 #ifndef YY_TYPEDEF_YY_SCANNER_T
5845 #define YY_TYPEDEF_YY_SCANNER_T
5846-typedef void* yyscan_t;
5847+typedef void *yyscan_t;
5848 #endif
5849
5850 /* For convenience, these vars (plus the bison vars far below)
5851@@ -153,7 +153,7 @@ typedef void* yyscan_t;
5852 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
5853
5854 /* Special action meaning "start processing a new file". */
5855-#define YY_NEW_FILE tsconfigrestart(yyin ,yyscanner )
5856+#define YY_NEW_FILE tsconfigrestart(yyin, yyscanner)
5857
5858 #define YY_END_OF_BUFFER_CHAR 0
5859
5860@@ -172,7 +172,7 @@ typedef void* yyscan_t;
5861
5862 /* The state buf must be large enough to hold one state per character in the main buffer.
5863 */
5864-#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
5865+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
5866
5867 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
5868 #define YY_TYPEDEF_YY_BUFFER_STATE
5869@@ -188,88 +188,84 @@ typedef size_t yy_size_t;
5870 #define EOB_ACT_END_OF_FILE 1
5871 #define EOB_ACT_LAST_MATCH 2
5872
5873- #define YY_LESS_LINENO(n)
5874- #define YY_LINENO_REWIND_TO(ptr)
5875+#define YY_LESS_LINENO(n)
5876+#define YY_LINENO_REWIND_TO(ptr)
5877
5878 /* Return all but the first "n" matched characters back to the input stream. */
5879-#define yyless(n) \
5880- do \
5881- { \
5882- /* Undo effects of setting up yytext. */ \
5883- yy_size_t yyless_macro_arg = (n); \
5884- YY_LESS_LINENO(yyless_macro_arg);\
5885- *yy_cp = yyg->yy_hold_char; \
5886- YY_RESTORE_YY_MORE_OFFSET \
5887- yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
5888- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
5889- } \
5890- while ( 0 )
5891-
5892-#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
5893+#define yyless(n) \
5894+ do { \
5895+ /* Undo effects of setting up yytext. */ \
5896+ yy_size_t yyless_macro_arg = (n); \
5897+ YY_LESS_LINENO(yyless_macro_arg); \
5898+ *yy_cp = yyg->yy_hold_char; \
5899+ YY_RESTORE_YY_MORE_OFFSET \
5900+ yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
5901+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
5902+ } while (0)
5903+
5904+#define unput(c) yyunput(c, yyg->yytext_ptr, yyscanner)
5905
5906 #ifndef YY_STRUCT_YY_BUFFER_STATE
5907 #define YY_STRUCT_YY_BUFFER_STATE
5908-struct yy_buffer_state
5909- {
5910- FILE *yy_input_file;
5911-
5912- char *yy_ch_buf; /* input buffer */
5913- char *yy_buf_pos; /* current position in input buffer */
5914-
5915- /* Size of input buffer in bytes, not including room for EOB
5916- * characters.
5917- */
5918- yy_size_t yy_buf_size;
5919-
5920- /* Number of characters read into yy_ch_buf, not including EOB
5921- * characters.
5922- */
5923- yy_size_t yy_n_chars;
5924-
5925- /* Whether we "own" the buffer - i.e., we know we created it,
5926- * and can realloc() it to grow it, and should free() it to
5927- * delete it.
5928- */
5929- int yy_is_our_buffer;
5930-
5931- /* Whether this is an "interactive" input source; if so, and
5932- * if we're using stdio for input, then we want to use getc()
5933- * instead of fread(), to make sure we stop fetching input after
5934- * each newline.
5935- */
5936- int yy_is_interactive;
5937-
5938- /* Whether we're considered to be at the beginning of a line.
5939- * If so, '^' rules will be active on the next match, otherwise
5940- * not.
5941- */
5942- int yy_at_bol;
5943-
5944- int yy_bs_lineno; /**< The line count. */
5945- int yy_bs_column; /**< The column count. */
5946-
5947- /* Whether to try to fill the input buffer when we reach the
5948- * end of it.
5949- */
5950- int yy_fill_buffer;
5951-
5952- int yy_buffer_status;
5953+struct yy_buffer_state {
5954+ FILE *yy_input_file;
5955+
5956+ char *yy_ch_buf; /* input buffer */
5957+ char *yy_buf_pos; /* current position in input buffer */
5958+
5959+ /* Size of input buffer in bytes, not including room for EOB
5960+ * characters.
5961+ */
5962+ yy_size_t yy_buf_size;
5963+
5964+ /* Number of characters read into yy_ch_buf, not including EOB
5965+ * characters.
5966+ */
5967+ yy_size_t yy_n_chars;
5968+
5969+ /* Whether we "own" the buffer - i.e., we know we created it,
5970+ * and can realloc() it to grow it, and should free() it to
5971+ * delete it.
5972+ */
5973+ int yy_is_our_buffer;
5974+
5975+ /* Whether this is an "interactive" input source; if so, and
5976+ * if we're using stdio for input, then we want to use getc()
5977+ * instead of fread(), to make sure we stop fetching input after
5978+ * each newline.
5979+ */
5980+ int yy_is_interactive;
5981+
5982+ /* Whether we're considered to be at the beginning of a line.
5983+ * If so, '^' rules will be active on the next match, otherwise
5984+ * not.
5985+ */
5986+ int yy_at_bol;
5987+
5988+ int yy_bs_lineno; /**< The line count. */
5989+ int yy_bs_column; /**< The column count. */
5990+
5991+ /* Whether to try to fill the input buffer when we reach the
5992+ * end of it.
5993+ */
5994+ int yy_fill_buffer;
5995+
5996+ int yy_buffer_status;
5997
5998 #define YY_BUFFER_NEW 0
5999 #define YY_BUFFER_NORMAL 1
6000- /* When an EOF's been seen but there's still some text to process
6001- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
6002- * shouldn't try reading from the input source any more. We might
6003- * still have a bunch of tokens to match, though, because of
6004- * possible backing-up.
6005- *
6006- * When we actually see the EOF, we change the status to "new"
6007- * (via tsconfigrestart()), so that the user can continue scanning by
6008- * just pointing yyin at a new input file.
6009- */
6010+ /* When an EOF's been seen but there's still some text to process
6011+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
6012+ * shouldn't try reading from the input source any more. We might
6013+ * still have a bunch of tokens to match, though, because of
6014+ * possible backing-up.
6015+ *
6016+ * When we actually see the EOF, we change the status to "new"
6017+ * (via tsconfigrestart()), so that the user can continue scanning by
6018+ * just pointing yyin at a new input file.
6019+ */
6020 #define YY_BUFFER_EOF_PENDING 2
6021-
6022- };
6023+};
6024 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
6025
6026 /* We provide macros for accessing buffer states in case in the
6027@@ -278,64 +274,60 @@ struct yy_buffer_state
6028 *
6029 * Returns the top of the stack, or NULL.
6030 */
6031-#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
6032- ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
6033- : NULL)
6034+#define YY_CURRENT_BUFFER (yyg->yy_buffer_stack ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] : NULL)
6035
6036 /* Same as previous macro, but useful when we know that the buffer stack is not
6037 * NULL or when we need an lvalue. For internal use only.
6038 */
6039 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
6040
6041-void tsconfigrestart (FILE *input_file ,yyscan_t yyscanner );
6042-void tsconfig_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
6043-YY_BUFFER_STATE tsconfig_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
6044-void tsconfig_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
6045-void tsconfig_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
6046-void tsconfigpush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
6047-void tsconfigpop_buffer_state (yyscan_t yyscanner );
6048+void tsconfigrestart(FILE *input_file, yyscan_t yyscanner);
6049+void tsconfig_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner);
6050+YY_BUFFER_STATE tsconfig_create_buffer(FILE *file, int size, yyscan_t yyscanner);
6051+void tsconfig_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner);
6052+void tsconfig_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner);
6053+void tsconfigpush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner);
6054+void tsconfigpop_buffer_state(yyscan_t yyscanner);
6055
6056-static void tsconfigensure_buffer_stack (yyscan_t yyscanner );
6057-static void tsconfig_load_buffer_state (yyscan_t yyscanner );
6058-static void tsconfig_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
6059+static void tsconfigensure_buffer_stack(yyscan_t yyscanner);
6060+static void tsconfig_load_buffer_state(yyscan_t yyscanner);
6061+static void tsconfig_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner);
6062
6063-#define YY_FLUSH_BUFFER tsconfig_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
6064+#define YY_FLUSH_BUFFER tsconfig_flush_buffer(YY_CURRENT_BUFFER, yyscanner)
6065
6066-YY_BUFFER_STATE tsconfig_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
6067-YY_BUFFER_STATE tsconfig_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
6068-YY_BUFFER_STATE tsconfig_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
6069+YY_BUFFER_STATE tsconfig_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner);
6070+YY_BUFFER_STATE tsconfig_scan_string(yyconst char *yy_str, yyscan_t yyscanner);
6071+YY_BUFFER_STATE tsconfig_scan_bytes(yyconst char *bytes, yy_size_t len, yyscan_t yyscanner);
6072
6073-void *tsconfigalloc (yy_size_t ,yyscan_t yyscanner );
6074-void *tsconfigrealloc (void *,yy_size_t ,yyscan_t yyscanner );
6075-void tsconfigfree (void * ,yyscan_t yyscanner );
6076+void *tsconfigalloc(yy_size_t, yyscan_t yyscanner);
6077+void *tsconfigrealloc(void *, yy_size_t, yyscan_t yyscanner);
6078+void tsconfigfree(void *, yyscan_t yyscanner);
6079
6080 #define yy_new_buffer tsconfig_create_buffer
6081
6082-#define yy_set_interactive(is_interactive) \
6083- { \
6084- if ( ! YY_CURRENT_BUFFER ){ \
6085- tsconfigensure_buffer_stack (yyscanner); \
6086- YY_CURRENT_BUFFER_LVALUE = \
6087- tsconfig_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
6088- } \
6089- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
6090- }
6091-
6092-#define yy_set_bol(at_bol) \
6093- { \
6094- if ( ! YY_CURRENT_BUFFER ){\
6095- tsconfigensure_buffer_stack (yyscanner); \
6096- YY_CURRENT_BUFFER_LVALUE = \
6097- tsconfig_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
6098- } \
6099- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
6100- }
6101+#define yy_set_interactive(is_interactive) \
6102+ { \
6103+ if (!YY_CURRENT_BUFFER) { \
6104+ tsconfigensure_buffer_stack(yyscanner); \
6105+ YY_CURRENT_BUFFER_LVALUE = tsconfig_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \
6106+ } \
6107+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
6108+ }
6109+
6110+#define yy_set_bol(at_bol) \
6111+ { \
6112+ if (!YY_CURRENT_BUFFER) { \
6113+ tsconfigensure_buffer_stack(yyscanner); \
6114+ YY_CURRENT_BUFFER_LVALUE = tsconfig_create_buffer(yyin, YY_BUF_SIZE, yyscanner); \
6115+ } \
6116+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
6117+ }
6118
6119 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
6120
6121 /* Begin user sect3 */
6122
6123-#define tsconfigwrap(yyscanner) (/*CONSTCOND*/1)
6124+#define tsconfigwrap(yyscanner) (/*CONSTCOND*/ 1)
6125 #define YY_SKIP_YYWRAP
6126
6127 typedef unsigned char YY_CHAR;
6128@@ -344,125 +336,70 @@ typedef int yy_state_type;
6129
6130 #define yytext_ptr yytext_r
6131
6132-static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
6133-static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
6134-static int yy_get_next_buffer (yyscan_t yyscanner );
6135+static yy_state_type yy_get_previous_state(yyscan_t yyscanner);
6136+static yy_state_type yy_try_NUL_trans(yy_state_type current_state, yyscan_t yyscanner);
6137+static int yy_get_next_buffer(yyscan_t yyscanner);
6138 #if defined(__GNUC__) && __GNUC__ >= 3
6139 __attribute__((__noreturn__))
6140 #endif
6141-static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
6142+static void
6143+yy_fatal_error(yyconst char msg[], yyscan_t yyscanner);
6144
6145 /* Done after the current pattern has been matched and before the
6146 * corresponding action - sets up yytext.
6147 */
6148-#define YY_DO_BEFORE_ACTION \
6149- yyg->yytext_ptr = yy_bp; \
6150- yyleng = (size_t) (yy_cp - yy_bp); \
6151- yyg->yy_hold_char = *yy_cp; \
6152- *yy_cp = '\0'; \
6153- yyg->yy_c_buf_p = yy_cp;
6154+#define YY_DO_BEFORE_ACTION \
6155+ yyg->yytext_ptr = yy_bp; \
6156+ yyleng = (size_t)(yy_cp - yy_bp); \
6157+ yyg->yy_hold_char = *yy_cp; \
6158+ *yy_cp = '\0'; \
6159+ yyg->yy_c_buf_p = yy_cp;
6160
6161 #define YY_NUM_RULES 21
6162 #define YY_END_OF_BUFFER 22
6163 /* This struct is not used in this scanner,
6164 but its presence is necessary. */
6165-struct yy_trans_info
6166- {
6167- flex_int32_t yy_verify;
6168- flex_int32_t yy_nxt;
6169- };
6170-static yyconst flex_int16_t yy_accept[48] =
6171- { 0,
6172- 0, 0, 0, 0, 22, 17, 3, 1, 17, 17,
6173- 10, 11, 16, 14, 17, 7, 12, 15, 13, 6,
6174- 8, 9, 3, 1, 17, 20, 19, 18, 3, 0,
6175- 2, 0, 0, 0, 16, 0, 7, 0, 6, 3,
6176- 0, 0, 0, 4, 0, 5, 0
6177- } ;
6178-
6179-static yyconst YY_CHAR yy_ec[256] =
6180- { 0,
6181- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
6182- 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
6183- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6184- 1, 2, 1, 4, 5, 1, 1, 1, 6, 7,
6185- 8, 1, 1, 9, 10, 11, 12, 13, 13, 13,
6186- 13, 13, 13, 13, 13, 13, 13, 1, 9, 14,
6187- 15, 16, 1, 1, 17, 17, 17, 17, 17, 17,
6188- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
6189- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
6190- 1, 18, 1, 1, 17, 1, 17, 17, 17, 17,
6191-
6192- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
6193- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
6194- 17, 17, 19, 1, 20, 1, 1, 1, 1, 1,
6195- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6196- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6197- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6198- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6199- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6200- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6201- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6202-
6203- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6204- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6205- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6206- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6207- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6208- 1, 1, 1, 1, 1
6209- } ;
6210-
6211-static yyconst YY_CHAR yy_meta[21] =
6212- { 0,
6213- 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
6214- 1, 1, 2, 1, 1, 1, 2, 1, 1, 1
6215- } ;
6216-
6217-static yyconst flex_uint16_t yy_base[54] =
6218- { 0,
6219- 0, 19, 23, 25, 67, 68, 64, 68, 19, 23,
6220- 68, 68, 56, 68, 52, 50, 68, 68, 68, 52,
6221- 68, 68, 28, 59, 57, 68, 68, 68, 57, 28,
6222- 68, 55, 29, 42, 35, 40, 29, 30, 0, 0,
6223- 0, 36, 35, 68, 33, 68, 68, 47, 49, 51,
6224- 32, 53, 55
6225- } ;
6226-
6227-static yyconst flex_int16_t yy_def[54] =
6228- { 0,
6229- 47, 1, 48, 48, 47, 47, 47, 47, 49, 50,
6230- 47, 47, 47, 47, 47, 47, 47, 47, 47, 51,
6231- 47, 47, 47, 23, 52, 47, 47, 47, 47, 49,
6232- 47, 49, 50, 50, 47, 53, 47, 51, 38, 23,
6233- 24, 52, 52, 47, 53, 47, 0, 47, 47, 47,
6234- 47, 47, 47
6235- } ;
6236-
6237-static yyconst flex_uint16_t yy_nxt[89] =
6238- { 0,
6239- 6, 7, 8, 9, 6, 10, 11, 12, 13, 6,
6240- 14, 15, 16, 17, 18, 19, 20, 6, 21, 22,
6241- 23, 24, 31, 25, 27, 28, 27, 28, 31, 40,
6242- 41, 31, 42, 39, 31, 46, 32, 44, 44, 38,
6243- 34, 37, 46, 35, 47, 32, 34, 26, 26, 30,
6244- 30, 33, 33, 43, 43, 45, 45, 47, 29, 44,
6245- 41, 38, 37, 36, 35, 29, 47, 5, 47, 47,
6246- 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
6247- 47, 47, 47, 47, 47, 47, 47, 47
6248- } ;
6249-
6250-static yyconst flex_int16_t yy_chk[89] =
6251- { 0,
6252- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6253- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6254- 2, 2, 9, 2, 3, 3, 4, 4, 10, 23,
6255- 23, 30, 23, 51, 33, 45, 9, 43, 42, 38,
6256- 10, 37, 36, 35, 34, 30, 33, 48, 48, 49,
6257- 49, 50, 50, 52, 52, 53, 53, 32, 29, 25,
6258- 24, 20, 16, 15, 13, 7, 5, 47, 47, 47,
6259- 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
6260- 47, 47, 47, 47, 47, 47, 47, 47
6261- } ;
6262+struct yy_trans_info {
6263+ flex_int32_t yy_verify;
6264+ flex_int32_t yy_nxt;
6265+};
6266+static yyconst flex_int16_t yy_accept[48] = {0, 0, 0, 0, 0, 22, 17, 3, 1, 17, 17, 10, 11, 16, 14, 17,
6267+ 7, 12, 15, 13, 6, 8, 9, 3, 1, 17, 20, 19, 18, 3, 0, 2,
6268+ 0, 0, 0, 16, 0, 7, 0, 6, 3, 0, 0, 0, 4, 0, 5, 0};
6269+
6270+static yyconst YY_CHAR yy_ec[256] = {
6271+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6272+ 1, 1, 1, 1, 2, 1, 4, 5, 1, 1, 1, 6, 7, 8, 1, 1, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 13, 13,
6273+ 13, 13, 1, 9, 14, 15, 16, 1, 1, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
6274+ 17, 17, 17, 17, 17, 17, 17, 1, 18, 1, 1, 17, 1, 17, 17, 17, 17,
6275+
6276+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 19, 1, 20, 1, 1, 1,
6277+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6278+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6279+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6280+
6281+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6282+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
6283+
6284+static yyconst YY_CHAR yy_meta[21] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1};
6285+
6286+static yyconst flex_uint16_t yy_base[54] = {0, 0, 19, 23, 25, 67, 68, 64, 68, 19, 23, 68, 68, 56, 68, 52, 50, 68,
6287+ 68, 68, 52, 68, 68, 28, 59, 57, 68, 68, 68, 57, 28, 68, 55, 29, 42, 35,
6288+ 40, 29, 30, 0, 0, 0, 36, 35, 68, 33, 68, 68, 47, 49, 51, 32, 53, 55};
6289+
6290+static yyconst flex_int16_t yy_def[54] = {0, 47, 1, 48, 48, 47, 47, 47, 47, 49, 50, 47, 47, 47, 47, 47, 47, 47,
6291+ 47, 47, 51, 47, 47, 47, 23, 52, 47, 47, 47, 47, 49, 47, 49, 50, 50, 47,
6292+ 53, 47, 51, 38, 23, 24, 52, 52, 47, 53, 47, 0, 47, 47, 47, 47, 47, 47};
6293+
6294+static yyconst flex_uint16_t yy_nxt[89] = {
6295+ 0, 6, 7, 8, 9, 6, 10, 11, 12, 13, 6, 14, 15, 16, 17, 18, 19, 20, 6, 21, 22, 23, 24, 31, 25, 27, 28, 27, 28, 31,
6296+ 40, 41, 31, 42, 39, 31, 46, 32, 44, 44, 38, 34, 37, 46, 35, 47, 32, 34, 26, 26, 30, 30, 33, 33, 43, 43, 45, 45, 47, 29,
6297+ 44, 41, 38, 37, 36, 35, 29, 47, 5, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47};
6298+
6299+static yyconst flex_int16_t yy_chk[89] = {
6300+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 9, 2, 3, 3, 4, 4, 10,
6301+ 23, 23, 30, 23, 51, 33, 45, 9, 43, 42, 38, 10, 37, 36, 35, 34, 30, 33, 48, 48, 49, 49, 50, 50, 52, 52, 53, 53, 32, 29,
6302+ 25, 24, 20, 16, 15, 13, 7, 5, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47};
6303
6304 /* The intent behind this definition is that it'll catch
6305 * any uses of REJECT which flex missed.
6306@@ -497,34 +434,37 @@ static yyconst flex_int16_t yy_chk[89] =
6307 limitations under the License.
6308 */
6309
6310-# if defined(__GNUC__)
6311-# pragma GCC diagnostic ignored "-Wsign-compare"
6312-# endif
6313-
6314+#if defined(__GNUC__)
6315+#pragma GCC diagnostic ignored "-Wsign-compare"
6316+#endif
6317
6318-# if ! (defined(__clang_analyzer__) || defined(__COVERITY__))
6319+#if !(defined(__clang_analyzer__) || defined(__COVERITY__))
6320
6321-# include "TsConfigParseEvents.h"
6322-# include "TsConfigGrammar.h"
6323+#include "TsConfigParseEvents.h"
6324+#include "TsConfigGrammar.h"
6325
6326-extern int tsconfigparse(yyscan_t lexer, struct TsConfigHandlers* handlers);
6327+extern int tsconfigparse(yyscan_t lexer, struct TsConfigHandlers *handlers);
6328
6329-struct Location TsConfig_Lex_Location = { 0, 1 };
6330+struct Location TsConfig_Lex_Location = {0, 1};
6331
6332-# define YY_USER_ACTION TsConfig_Lex_Location._col += yyleng;
6333+#define YY_USER_ACTION TsConfig_Lex_Location._col += yyleng;
6334
6335-# define FILL \
6336- yylval->_s = yytext; \
6337- yylval->_n = yyleng; \
6338+#define FILL \
6339+ yylval->_s = yytext; \
6340+ yylval->_n = yyleng; \
6341 yylval->_loc = TsConfig_Lex_Location; \
6342 yylval->_loc._col -= yyleng;
6343
6344-# define ZRET(t) FILL; yylval->_type = t; return t;
6345+#define ZRET(t) \
6346+ FILL; \
6347+ yylval->_type = t; \
6348+ return t;
6349
6350-# define HANDLE_EVENT(x) \
6351- if (yyextra) { \
6352- struct TsConfigEventHandler* h = &(yyextra->handler[TsConfigEvent##x]); \
6353- if (h->_f) h->_f(h->_data, yylval); \
6354+#define HANDLE_EVENT(x) \
6355+ if (yyextra) { \
6356+ struct TsConfigEventHandler *h = &(yyextra->handler[TsConfigEvent##x]); \
6357+ if (h->_f) \
6358+ h->_f(h->_data, yylval); \
6359 }
6360
6361 #define YY_NO_INPUT 1
6362@@ -542,90 +482,88 @@ struct Location TsConfig_Lex_Location = { 0, 1 };
6363 #include <unistd.h>
6364 #endif
6365
6366-#define YY_EXTRA_TYPE struct TsConfigHandlers*
6367+#define YY_EXTRA_TYPE struct TsConfigHandlers *
6368
6369 /* Holds the entire state of the reentrant scanner. */
6370-struct yyguts_t
6371- {
6372+struct yyguts_t {
6373+ /* User-defined. Not touched by flex. */
6374+ YY_EXTRA_TYPE yyextra_r;
6375
6376- /* User-defined. Not touched by flex. */
6377- YY_EXTRA_TYPE yyextra_r;
6378+ /* The rest are the same as the globals declared in the non-reentrant scanner. */
6379+ FILE *yyin_r, *yyout_r;
6380+ size_t yy_buffer_stack_top; /**< index of top of stack. */
6381+ size_t yy_buffer_stack_max; /**< capacity of stack. */
6382+ YY_BUFFER_STATE *yy_buffer_stack; /**< Stack as an array. */
6383+ char yy_hold_char;
6384+ yy_size_t yy_n_chars;
6385+ yy_size_t yyleng_r;
6386+ char *yy_c_buf_p;
6387+ int yy_init;
6388+ int yy_start;
6389+ int yy_did_buffer_switch_on_eof;
6390+ int yy_start_stack_ptr;
6391+ int yy_start_stack_depth;
6392+ int *yy_start_stack;
6393+ yy_state_type yy_last_accepting_state;
6394+ char *yy_last_accepting_cpos;
6395
6396- /* The rest are the same as the globals declared in the non-reentrant scanner. */
6397- FILE *yyin_r, *yyout_r;
6398- size_t yy_buffer_stack_top; /**< index of top of stack. */
6399- size_t yy_buffer_stack_max; /**< capacity of stack. */
6400- YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
6401- char yy_hold_char;
6402- yy_size_t yy_n_chars;
6403- yy_size_t yyleng_r;
6404- char *yy_c_buf_p;
6405- int yy_init;
6406- int yy_start;
6407- int yy_did_buffer_switch_on_eof;
6408- int yy_start_stack_ptr;
6409- int yy_start_stack_depth;
6410- int *yy_start_stack;
6411- yy_state_type yy_last_accepting_state;
6412- char* yy_last_accepting_cpos;
6413+ int yylineno_r;
6414+ int yy_flex_debug_r;
6415
6416- int yylineno_r;
6417- int yy_flex_debug_r;
6418+ char *yytext_r;
6419+ int yy_more_flag;
6420+ int yy_more_len;
6421
6422- char *yytext_r;
6423- int yy_more_flag;
6424- int yy_more_len;
6425+ YYSTYPE *yylval_r;
6426
6427- YYSTYPE * yylval_r;
6428+}; /* end struct yyguts_t */
6429
6430- }; /* end struct yyguts_t */
6431+static int yy_init_globals(yyscan_t yyscanner);
6432
6433-static int yy_init_globals (yyscan_t yyscanner );
6434+/* This must go here because YYSTYPE and YYLTYPE are included
6435+ * from bison output in section 1.*/
6436+#define yylval yyg->yylval_r
6437
6438- /* This must go here because YYSTYPE and YYLTYPE are included
6439- * from bison output in section 1.*/
6440- # define yylval yyg->yylval_r
6441+int tsconfiglex_init(yyscan_t *scanner);
6442
6443-int tsconfiglex_init (yyscan_t* scanner);
6444-
6445-int tsconfiglex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
6446+int tsconfiglex_init_extra(YY_EXTRA_TYPE user_defined, yyscan_t *scanner);
6447
6448 /* Accessor methods to globals.
6449 These are made visible to non-reentrant scanners for convenience. */
6450
6451-int tsconfiglex_destroy (yyscan_t yyscanner );
6452+int tsconfiglex_destroy(yyscan_t yyscanner);
6453
6454-int tsconfigget_debug (yyscan_t yyscanner );
6455+int tsconfigget_debug(yyscan_t yyscanner);
6456
6457-void tsconfigset_debug (int debug_flag ,yyscan_t yyscanner );
6458+void tsconfigset_debug(int debug_flag, yyscan_t yyscanner);
6459
6460-YY_EXTRA_TYPE tsconfigget_extra (yyscan_t yyscanner );
6461+YY_EXTRA_TYPE tsconfigget_extra(yyscan_t yyscanner);
6462
6463-void tsconfigset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
6464+void tsconfigset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner);
6465
6466-FILE *tsconfigget_in (yyscan_t yyscanner );
6467+FILE *tsconfigget_in(yyscan_t yyscanner);
6468
6469-void tsconfigset_in (FILE * _in_str ,yyscan_t yyscanner );
6470+void tsconfigset_in(FILE *_in_str, yyscan_t yyscanner);
6471
6472-FILE *tsconfigget_out (yyscan_t yyscanner );
6473+FILE *tsconfigget_out(yyscan_t yyscanner);
6474
6475-void tsconfigset_out (FILE * _out_str ,yyscan_t yyscanner );
6476+void tsconfigset_out(FILE *_out_str, yyscan_t yyscanner);
6477
6478-yy_size_t tsconfigget_leng (yyscan_t yyscanner );
6479+yy_size_t tsconfigget_leng(yyscan_t yyscanner);
6480
6481-char *tsconfigget_text (yyscan_t yyscanner );
6482+char *tsconfigget_text(yyscan_t yyscanner);
6483
6484-int tsconfigget_lineno (yyscan_t yyscanner );
6485+int tsconfigget_lineno(yyscan_t yyscanner);
6486
6487-void tsconfigset_lineno (int _line_number ,yyscan_t yyscanner );
6488+void tsconfigset_lineno(int _line_number, yyscan_t yyscanner);
6489
6490-int tsconfigget_column (yyscan_t yyscanner );
6491+int tsconfigget_column(yyscan_t yyscanner);
6492
6493-void tsconfigset_column (int _column_no ,yyscan_t yyscanner );
6494+void tsconfigset_column(int _column_no, yyscan_t yyscanner);
6495
6496-YYSTYPE * tsconfigget_lval (yyscan_t yyscanner );
6497+YYSTYPE *tsconfigget_lval(yyscan_t yyscanner);
6498
6499-void tsconfigset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
6500+void tsconfigset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner);
6501
6502 /* Macros after this point can all be overridden by user definitions in
6503 * section 1.
6504@@ -633,9 +571,9 @@ void tsconfigset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
6505
6506 #ifndef YY_SKIP_YYWRAP
6507 #ifdef __cplusplus
6508-extern "C" int tsconfigwrap (yyscan_t yyscanner );
6509+extern "C" int tsconfigwrap(yyscan_t yyscanner);
6510 #else
6511-extern int tsconfigwrap (yyscan_t yyscanner );
6512+extern int tsconfigwrap(yyscan_t yyscanner);
6513 #endif
6514 #endif
6515
6516@@ -644,19 +582,19 @@ extern int tsconfigwrap (yyscan_t yyscanner );
6517 #endif
6518
6519 #ifndef yytext_ptr
6520-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
6521+static void yy_flex_strncpy(char *, yyconst char *, int, yyscan_t yyscanner);
6522 #endif
6523
6524 #ifdef YY_NEED_STRLEN
6525-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
6526+static int yy_flex_strlen(yyconst char *, yyscan_t yyscanner);
6527 #endif
6528
6529 #ifndef YY_NO_INPUT
6530
6531 #ifdef __cplusplus
6532-static int yyinput (yyscan_t yyscanner );
6533+static int yyinput(yyscan_t yyscanner);
6534 #else
6535-static int input (yyscan_t yyscanner );
6536+static int input(yyscan_t yyscanner);
6537 #endif
6538
6539 #endif
6540@@ -676,42 +614,39 @@ static int input (yyscan_t yyscanner );
6541 /* This used to be an fputs(), but since the string might contain NUL's,
6542 * we now use fwrite().
6543 */
6544-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
6545+#define ECHO \
6546+ do { \
6547+ if (fwrite(yytext, yyleng, 1, yyout)) { \
6548+ } \
6549+ } while (0)
6550 #endif
6551
6552 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
6553 * is returned in "result".
6554 */
6555 #ifndef YY_INPUT
6556-#define YY_INPUT(buf,result,max_size) \
6557- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
6558- { \
6559- int c = '*'; \
6560- size_t n; \
6561- for ( n = 0; n < max_size && \
6562- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
6563- buf[n] = (char) c; \
6564- if ( c == '\n' ) \
6565- buf[n++] = (char) c; \
6566- if ( c == EOF && ferror( yyin ) ) \
6567- YY_FATAL_ERROR( "input in flex scanner failed" ); \
6568- result = n; \
6569- } \
6570- else \
6571- { \
6572- errno=0; \
6573- while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
6574- { \
6575- if( errno != EINTR) \
6576- { \
6577- YY_FATAL_ERROR( "input in flex scanner failed" ); \
6578- break; \
6579- } \
6580- errno=0; \
6581- clearerr(yyin); \
6582- } \
6583- }\
6584-\
6585+#define YY_INPUT(buf, result, max_size) \
6586+ if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) { \
6587+ int c = '*'; \
6588+ size_t n; \
6589+ for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n) \
6590+ buf[n] = (char)c; \
6591+ if (c == '\n') \
6592+ buf[n++] = (char)c; \
6593+ if (c == EOF && ferror(yyin)) \
6594+ YY_FATAL_ERROR("input in flex scanner failed"); \
6595+ result = n; \
6596+ } else { \
6597+ errno = 0; \
6598+ while ((result = fread(buf, 1, max_size, yyin)) == 0 && ferror(yyin)) { \
6599+ if (errno != EINTR) { \
6600+ YY_FATAL_ERROR("input in flex scanner failed"); \
6601+ break; \
6602+ } \
6603+ errno = 0; \
6604+ clearerr(yyin); \
6605+ } \
6606+ }
6607
6608 #endif
6609
6610@@ -730,7 +665,7 @@ static int input (yyscan_t yyscanner );
6611
6612 /* Report a fatal error. */
6613 #ifndef YY_FATAL_ERROR
6614-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
6615+#define YY_FATAL_ERROR(msg) yy_fatal_error(msg, yyscanner)
6616 #endif
6617
6618 /* end tables serialization structures and prototypes */
6619@@ -741,11 +676,9 @@ static int input (yyscan_t yyscanner );
6620 #ifndef YY_DECL
6621 #define YY_DECL_IS_OURS 1
6622
6623-extern int tsconfiglex \
6624- (YYSTYPE * yylval_param ,yyscan_t yyscanner);
6625+extern int tsconfiglex(YYSTYPE *yylval_param, yyscan_t yyscanner);
6626
6627-#define YY_DECL int tsconfiglex \
6628- (YYSTYPE * yylval_param , yyscan_t yyscanner)
6629+#define YY_DECL int tsconfiglex(YYSTYPE *yylval_param, yyscan_t yyscanner)
6630 #endif /* !YY_DECL */
6631
6632 /* Code executed at the beginning of each rule, after yytext and yyleng
6633@@ -757,368 +690,350 @@ extern int tsconfiglex \
6634
6635 /* Code executed at the end of each rule. */
6636 #ifndef YY_BREAK
6637-#define YY_BREAK /*LINTED*/break;
6638+#define YY_BREAK /*LINTED*/ break;
6639 #endif
6640
6641-#define YY_RULE_SETUP \
6642- if ( yyleng > 0 ) \
6643- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
6644- (yytext[yyleng - 1] == '\n'); \
6645- YY_USER_ACTION
6646+#define YY_RULE_SETUP \
6647+ if (yyleng > 0) \
6648+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (yytext[yyleng - 1] == '\n'); \
6649+ YY_USER_ACTION
6650
6651 /** The main scanner function which does all the work.
6652 */
6653 YY_DECL
6654 {
6655- yy_state_type yy_current_state;
6656- char *yy_cp, *yy_bp;
6657- int yy_act;
6658- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
6659+ yy_state_type yy_current_state;
6660+ char *yy_cp, *yy_bp;
6661+ int yy_act;
6662+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
6663
6664- yylval = yylval_param;
6665+ yylval = yylval_param;
6666
6667- if ( !yyg->yy_init )
6668- {
6669- yyg->yy_init = 1;
6670+ if (!yyg->yy_init) {
6671+ yyg->yy_init = 1;
6672
6673 #ifdef YY_USER_INIT
6674- YY_USER_INIT;
6675+ YY_USER_INIT;
6676 #endif
6677
6678- if ( ! yyg->yy_start )
6679- yyg->yy_start = 1; /* first start state */
6680+ if (!yyg->yy_start)
6681+ yyg->yy_start = 1; /* first start state */
6682
6683- if ( ! yyin )
6684- yyin = stdin;
6685+ if (!yyin)
6686+ yyin = stdin;
6687
6688- if ( ! yyout )
6689- yyout = stdout;
6690+ if (!yyout)
6691+ yyout = stdout;
6692
6693- if ( ! YY_CURRENT_BUFFER ) {
6694- tsconfigensure_buffer_stack (yyscanner);
6695- YY_CURRENT_BUFFER_LVALUE =
6696- tsconfig_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
6697- }
6698+ if (!YY_CURRENT_BUFFER) {
6699+ tsconfigensure_buffer_stack(yyscanner);
6700+ YY_CURRENT_BUFFER_LVALUE = tsconfig_create_buffer(yyin, YY_BUF_SIZE, yyscanner);
6701+ }
6702
6703- tsconfig_load_buffer_state(yyscanner );
6704- }
6705+ tsconfig_load_buffer_state(yyscanner);
6706+ }
6707
6708- {
6709+ {
6710 #line 71 "TsConfigSyntax.l"
6711
6712-
6713 #line 811 "TsConfigSyntax.c"
6714
6715- while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
6716- {
6717- yy_cp = yyg->yy_c_buf_p;
6718-
6719- /* Support of yytext. */
6720- *yy_cp = yyg->yy_hold_char;
6721-
6722- /* yy_bp points to the position in yy_ch_buf of the start of
6723- * the current run.
6724- */
6725- yy_bp = yy_cp;
6726-
6727- yy_current_state = yyg->yy_start;
6728- yy_current_state += YY_AT_BOL();
6729-yy_match:
6730- do
6731- {
6732- YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
6733- if ( yy_accept[yy_current_state] )
6734- {
6735- yyg->yy_last_accepting_state = yy_current_state;
6736- yyg->yy_last_accepting_cpos = yy_cp;
6737- }
6738- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
6739- {
6740- yy_current_state = (int) yy_def[yy_current_state];
6741- if ( yy_current_state >= 48 )
6742- yy_c = yy_meta[(unsigned int) yy_c];
6743- }
6744- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
6745- ++yy_cp;
6746- }
6747- while ( yy_current_state != 47 );
6748- yy_cp = yyg->yy_last_accepting_cpos;
6749- yy_current_state = yyg->yy_last_accepting_state;
6750-
6751-yy_find_action:
6752- yy_act = yy_accept[yy_current_state];
6753-
6754- YY_DO_BEFORE_ACTION;
6755-
6756-do_action: /* This label is used only to access EOF actions. */
6757-
6758- switch ( yy_act )
6759- { /* beginning of action switch */
6760- case 0: /* must back up */
6761- /* undo the effects of YY_DO_BEFORE_ACTION */
6762- *yy_cp = yyg->yy_hold_char;
6763- yy_cp = yyg->yy_last_accepting_cpos;
6764- yy_current_state = yyg->yy_last_accepting_state;
6765- goto yy_find_action;
6766-
6767-case 1:
6768-/* rule 1 can match eol */
6769-YY_RULE_SETUP
6770+ while (/*CONSTCOND*/ 1) /* loops until end-of-file is reached */
6771+ {
6772+ yy_cp = yyg->yy_c_buf_p;
6773+
6774+ /* Support of yytext. */
6775+ *yy_cp = yyg->yy_hold_char;
6776+
6777+ /* yy_bp points to the position in yy_ch_buf of the start of
6778+ * the current run.
6779+ */
6780+ yy_bp = yy_cp;
6781+
6782+ yy_current_state = yyg->yy_start;
6783+ yy_current_state += YY_AT_BOL();
6784+ yy_match:
6785+ do {
6786+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
6787+ if (yy_accept[yy_current_state]) {
6788+ yyg->yy_last_accepting_state = yy_current_state;
6789+ yyg->yy_last_accepting_cpos = yy_cp;
6790+ }
6791+ while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
6792+ yy_current_state = (int)yy_def[yy_current_state];
6793+ if (yy_current_state >= 48)
6794+ yy_c = yy_meta[(unsigned int)yy_c];
6795+ }
6796+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c];
6797+ ++yy_cp;
6798+ } while (yy_current_state != 47);
6799+ yy_cp = yyg->yy_last_accepting_cpos;
6800+ yy_current_state = yyg->yy_last_accepting_state;
6801+
6802+ yy_find_action:
6803+ yy_act = yy_accept[yy_current_state];
6804+
6805+ YY_DO_BEFORE_ACTION;
6806+
6807+ do_action: /* This label is used only to access EOF actions. */
6808+
6809+ switch (yy_act) { /* beginning of action switch */
6810+ case 0: /* must back up */
6811+ /* undo the effects of YY_DO_BEFORE_ACTION */
6812+ *yy_cp = yyg->yy_hold_char;
6813+ yy_cp = yyg->yy_last_accepting_cpos;
6814+ yy_current_state = yyg->yy_last_accepting_state;
6815+ goto yy_find_action;
6816+
6817+ case 1:
6818+ /* rule 1 can match eol */
6819+ YY_RULE_SETUP
6820 #line 73 "TsConfigSyntax.l"
6821-{
6822- ++(TsConfig_Lex_Location._line);
6823- TsConfig_Lex_Location._col = 0;
6824- }
6825- YY_BREAK
6826-case 2:
6827-/* rule 2 can match eol */
6828-YY_RULE_SETUP
6829+ {
6830+ ++(TsConfig_Lex_Location._line);
6831+ TsConfig_Lex_Location._col = 0;
6832+ }
6833+ YY_BREAK
6834+ case 2:
6835+ /* rule 2 can match eol */
6836+ YY_RULE_SETUP
6837 #line 78 "TsConfigSyntax.l"
6838-ZRET(STRING); /* Quote string overrides comments */
6839- YY_BREAK
6840-case 3:
6841-YY_RULE_SETUP
6842+ ZRET(STRING); /* Quote string overrides comments */
6843+ YY_BREAK
6844+ case 3:
6845+ YY_RULE_SETUP
6846 #line 80 "TsConfigSyntax.l"
6847-/* Ignore all white space. */
6848- YY_BREAK
6849-case 4:
6850-/* rule 4 can match eol */
6851-*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
6852-YY_LINENO_REWIND_TO(yy_cp - 1);
6853-yyg->yy_c_buf_p = yy_cp -= 1;
6854-YY_DO_BEFORE_ACTION; /* set up yytext again */
6855-YY_RULE_SETUP
6856+ /* Ignore all white space. */
6857+ YY_BREAK
6858+ case 4:
6859+ /* rule 4 can match eol */
6860+ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
6861+ YY_LINENO_REWIND_TO(yy_cp - 1);
6862+ yyg->yy_c_buf_p = yy_cp -= 1;
6863+ YY_DO_BEFORE_ACTION; /* set up yytext again */
6864+ YY_RULE_SETUP
6865 #line 81 "TsConfigSyntax.l"
6866-/* Leading '#' is a comment. */
6867- YY_BREAK
6868-case 5:
6869-*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
6870-yyg->yy_c_buf_p = yy_cp -= 1;
6871-YY_DO_BEFORE_ACTION; /* set up yytext again */
6872-YY_RULE_SETUP
6873+ /* Leading '#' is a comment. */
6874+ YY_BREAK
6875+ case 5:
6876+ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
6877+ yyg->yy_c_buf_p = yy_cp -= 1;
6878+ YY_DO_BEFORE_ACTION; /* set up yytext again */
6879+ YY_RULE_SETUP
6880 #line 82 "TsConfigSyntax.l"
6881-/* Trailing '//' is a comment. */
6882- YY_BREAK
6883-case 6:
6884-YY_RULE_SETUP
6885+ /* Trailing '//' is a comment. */
6886+ YY_BREAK
6887+ case 6:
6888+ YY_RULE_SETUP
6889 #line 84 "TsConfigSyntax.l"
6890-ZRET(IDENT);
6891- YY_BREAK
6892-case 7:
6893-YY_RULE_SETUP
6894+ ZRET(IDENT);
6895+ YY_BREAK
6896+ case 7:
6897+ YY_RULE_SETUP
6898 #line 85 "TsConfigSyntax.l"
6899-ZRET(INTEGER);
6900- YY_BREAK
6901-case 8:
6902-YY_RULE_SETUP
6903+ ZRET(INTEGER);
6904+ YY_BREAK
6905+ case 8:
6906+ YY_RULE_SETUP
6907 #line 86 "TsConfigSyntax.l"
6908-ZRET(GROUP_OPEN);
6909- YY_BREAK
6910-case 9:
6911-YY_RULE_SETUP
6912+ ZRET(GROUP_OPEN);
6913+ YY_BREAK
6914+ case 9:
6915+ YY_RULE_SETUP
6916 #line 87 "TsConfigSyntax.l"
6917-ZRET(GROUP_CLOSE);
6918- YY_BREAK
6919-case 10:
6920-YY_RULE_SETUP
6921+ ZRET(GROUP_CLOSE);
6922+ YY_BREAK
6923+ case 10:
6924+ YY_RULE_SETUP
6925 #line 88 "TsConfigSyntax.l"
6926-ZRET(LIST_OPEN);
6927- YY_BREAK
6928-case 11:
6929-YY_RULE_SETUP
6930+ ZRET(LIST_OPEN);
6931+ YY_BREAK
6932+ case 11:
6933+ YY_RULE_SETUP
6934 #line 89 "TsConfigSyntax.l"
6935-ZRET(LIST_CLOSE);
6936- YY_BREAK
6937-case 12:
6938-YY_RULE_SETUP
6939+ ZRET(LIST_CLOSE);
6940+ YY_BREAK
6941+ case 12:
6942+ YY_RULE_SETUP
6943 #line 90 "TsConfigSyntax.l"
6944-ZRET(PATH_OPEN);
6945- YY_BREAK
6946-case 13:
6947-YY_RULE_SETUP
6948+ ZRET(PATH_OPEN);
6949+ YY_BREAK
6950+ case 13:
6951+ YY_RULE_SETUP
6952 #line 91 "TsConfigSyntax.l"
6953-ZRET(PATH_CLOSE);
6954- YY_BREAK
6955-case 14:
6956-YY_RULE_SETUP
6957+ ZRET(PATH_CLOSE);
6958+ YY_BREAK
6959+ case 14:
6960+ YY_RULE_SETUP
6961 #line 92 "TsConfigSyntax.l"
6962-ZRET(PATH_SEPARATOR);
6963- YY_BREAK
6964-case 15:
6965-YY_RULE_SETUP
6966+ ZRET(PATH_SEPARATOR);
6967+ YY_BREAK
6968+ case 15:
6969+ YY_RULE_SETUP
6970 #line 93 "TsConfigSyntax.l"
6971-ZRET(ASSIGN);
6972- YY_BREAK
6973-case 16:
6974-YY_RULE_SETUP
6975+ ZRET(ASSIGN);
6976+ YY_BREAK
6977+ case 16:
6978+ YY_RULE_SETUP
6979 #line 94 "TsConfigSyntax.l"
6980-ZRET(SEPARATOR);
6981- YY_BREAK
6982-case 17:
6983-YY_RULE_SETUP
6984+ ZRET(SEPARATOR);
6985+ YY_BREAK
6986+ case 17:
6987+ YY_RULE_SETUP
6988 #line 96 "TsConfigSyntax.l"
6989-BEGIN(bad); FILL;
6990- YY_BREAK
6991-case 18:
6992-/* rule 18 can match eol */
6993-YY_RULE_SETUP
6994+ BEGIN(bad);
6995+ FILL;
6996+ YY_BREAK
6997+ case 18:
6998+ /* rule 18 can match eol */
6999+ YY_RULE_SETUP
7000 #line 97 "TsConfigSyntax.l"
7001-{
7002- BEGIN(0); // Terminate bad token mode.
7003- ++(TsConfig_Lex_Location._line); // Must bump line count.
7004- HANDLE_EVENT(InvalidToken);
7005- }
7006- YY_BREAK
7007-case 19:
7008-/* rule 19 can match eol */
7009-YY_RULE_SETUP
7010+ {
7011+ BEGIN(0); // Terminate bad token mode.
7012+ ++(TsConfig_Lex_Location._line); // Must bump line count.
7013+ HANDLE_EVENT(InvalidToken);
7014+ }
7015+ YY_BREAK
7016+ case 19:
7017+ /* rule 19 can match eol */
7018+ YY_RULE_SETUP
7019 #line 102 "TsConfigSyntax.l"
7020-BEGIN(0); HANDLE_EVENT(InvalidToken);
7021- YY_BREAK
7022-case 20:
7023-YY_RULE_SETUP
7024+ BEGIN(0);
7025+ HANDLE_EVENT(InvalidToken);
7026+ YY_BREAK
7027+ case 20:
7028+ YY_RULE_SETUP
7029 #line 103 "TsConfigSyntax.l"
7030-++(yylval->_n);
7031- YY_BREAK
7032-case 21:
7033-YY_RULE_SETUP
7034+ ++(yylval->_n);
7035+ YY_BREAK
7036+ case 21:
7037+ YY_RULE_SETUP
7038 #line 104 "TsConfigSyntax.l"
7039-ECHO;
7040- YY_BREAK
7041+ ECHO;
7042+ YY_BREAK
7043 #line 989 "TsConfigSyntax.c"
7044-case YY_STATE_EOF(INITIAL):
7045-case YY_STATE_EOF(bad):
7046- yyterminate();
7047-
7048- case YY_END_OF_BUFFER:
7049- {
7050- /* Amount of text matched not including the EOB char. */
7051- int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
7052-
7053- /* Undo the effects of YY_DO_BEFORE_ACTION. */
7054- *yy_cp = yyg->yy_hold_char;
7055- YY_RESTORE_YY_MORE_OFFSET
7056-
7057- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
7058- {
7059- /* We're scanning a new file or input source. It's
7060- * possible that this happened because the user
7061- * just pointed yyin at a new source and called
7062- * tsconfiglex(). If so, then we have to assure
7063- * consistency between YY_CURRENT_BUFFER and our
7064- * globals. Here is the right place to do so, because
7065- * this is the first action (other than possibly a
7066- * back-up) that will match for the new input source.
7067- */
7068- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
7069- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
7070- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
7071- }
7072-
7073- /* Note that here we test for yy_c_buf_p "<=" to the position
7074- * of the first EOB in the buffer, since yy_c_buf_p will
7075- * already have been incremented past the NUL character
7076- * (since all states make transitions on EOB to the
7077- * end-of-buffer state). Contrast this with the test
7078- * in input().
7079- */
7080- if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
7081- { /* This was really a NUL. */
7082- yy_state_type yy_next_state;
7083-
7084- yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
7085-
7086- yy_current_state = yy_get_previous_state( yyscanner );
7087-
7088- /* Okay, we're now positioned to make the NUL
7089- * transition. We couldn't have
7090- * yy_get_previous_state() go ahead and do it
7091- * for us because it doesn't know how to deal
7092- * with the possibility of jamming (and we don't
7093- * want to build jamming into it because then it
7094- * will run more slowly).
7095- */
7096-
7097- yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
7098-
7099- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
7100-
7101- if ( yy_next_state )
7102- {
7103- /* Consume the NUL. */
7104- yy_cp = ++yyg->yy_c_buf_p;
7105- yy_current_state = yy_next_state;
7106- goto yy_match;
7107- }
7108-
7109- else
7110- {
7111- yy_cp = yyg->yy_last_accepting_cpos;
7112- yy_current_state = yyg->yy_last_accepting_state;
7113- goto yy_find_action;
7114- }
7115- }
7116-
7117- else switch ( yy_get_next_buffer( yyscanner ) )
7118- {
7119- case EOB_ACT_END_OF_FILE:
7120- {
7121- yyg->yy_did_buffer_switch_on_eof = 0;
7122-
7123- if ( tsconfigwrap(yyscanner ) )
7124- {
7125- /* Note: because we've taken care in
7126- * yy_get_next_buffer() to have set up
7127- * yytext, we can now set up
7128- * yy_c_buf_p so that if some total
7129- * hoser (like flex itself) wants to
7130- * call the scanner after we return the
7131- * YY_NULL, it'll still work - another
7132- * YY_NULL will get returned.
7133- */
7134- yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
7135-
7136- yy_act = YY_STATE_EOF(YY_START);
7137- goto do_action;
7138- }
7139-
7140- else
7141- {
7142- if ( ! yyg->yy_did_buffer_switch_on_eof )
7143- YY_NEW_FILE;
7144- }
7145- break;
7146- }
7147-
7148- case EOB_ACT_CONTINUE_SCAN:
7149- yyg->yy_c_buf_p =
7150- yyg->yytext_ptr + yy_amount_of_matched_text;
7151-
7152- yy_current_state = yy_get_previous_state( yyscanner );
7153-
7154- yy_cp = yyg->yy_c_buf_p;
7155- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
7156- goto yy_match;
7157-
7158- case EOB_ACT_LAST_MATCH:
7159- yyg->yy_c_buf_p =
7160- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
7161-
7162- yy_current_state = yy_get_previous_state( yyscanner );
7163-
7164- yy_cp = yyg->yy_c_buf_p;
7165- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
7166- goto yy_find_action;
7167- }
7168- break;
7169- }
7170-
7171- default:
7172- YY_FATAL_ERROR(
7173- "fatal flex scanner internal error--no action found" );
7174- } /* end of action switch */
7175- } /* end of scanning one token */
7176- } /* end of user's declarations */
7177+ case YY_STATE_EOF(INITIAL):
7178+ case YY_STATE_EOF(bad):
7179+ yyterminate();
7180+
7181+ case YY_END_OF_BUFFER: {
7182+ /* Amount of text matched not including the EOB char. */
7183+ int yy_amount_of_matched_text = (int)(yy_cp - yyg->yytext_ptr) - 1;
7184+
7185+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
7186+ *yy_cp = yyg->yy_hold_char;
7187+ YY_RESTORE_YY_MORE_OFFSET
7188+
7189+ if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW) {
7190+ /* We're scanning a new file or input source. It's
7191+ * possible that this happened because the user
7192+ * just pointed yyin at a new source and called
7193+ * tsconfiglex(). If so, then we have to assure
7194+ * consistency between YY_CURRENT_BUFFER and our
7195+ * globals. Here is the right place to do so, because
7196+ * this is the first action (other than possibly a
7197+ * back-up) that will match for the new input source.
7198+ */
7199+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
7200+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
7201+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
7202+ }
7203+
7204+ /* Note that here we test for yy_c_buf_p "<=" to the position
7205+ * of the first EOB in the buffer, since yy_c_buf_p will
7206+ * already have been incremented past the NUL character
7207+ * (since all states make transitions on EOB to the
7208+ * end-of-buffer state). Contrast this with the test
7209+ * in input().
7210+ */
7211+ if (yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]) { /* This was really a NUL. */
7212+ yy_state_type yy_next_state;
7213+
7214+ yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
7215+
7216+ yy_current_state = yy_get_previous_state(yyscanner);
7217+
7218+ /* Okay, we're now positioned to make the NUL
7219+ * transition. We couldn't have
7220+ * yy_get_previous_state() go ahead and do it
7221+ * for us because it doesn't know how to deal
7222+ * with the possibility of jamming (and we don't
7223+ * want to build jamming into it because then it
7224+ * will run more slowly).
7225+ */
7226+
7227+ yy_next_state = yy_try_NUL_trans(yy_current_state, yyscanner);
7228+
7229+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
7230+
7231+ if (yy_next_state) {
7232+ /* Consume the NUL. */
7233+ yy_cp = ++yyg->yy_c_buf_p;
7234+ yy_current_state = yy_next_state;
7235+ goto yy_match;
7236+ }
7237+
7238+ else {
7239+ yy_cp = yyg->yy_last_accepting_cpos;
7240+ yy_current_state = yyg->yy_last_accepting_state;
7241+ goto yy_find_action;
7242+ }
7243+ }
7244+
7245+ else
7246+ switch (yy_get_next_buffer(yyscanner)) {
7247+ case EOB_ACT_END_OF_FILE: {
7248+ yyg->yy_did_buffer_switch_on_eof = 0;
7249+
7250+ if (tsconfigwrap(yyscanner)) {
7251+ /* Note: because we've taken care in
7252+ * yy_get_next_buffer() to have set up
7253+ * yytext, we can now set up
7254+ * yy_c_buf_p so that if some total
7255+ * hoser (like flex itself) wants to
7256+ * call the scanner after we return the
7257+ * YY_NULL, it'll still work - another
7258+ * YY_NULL will get returned.
7259+ */
7260+ yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
7261+
7262+ yy_act = YY_STATE_EOF(YY_START);
7263+ goto do_action;
7264+ }
7265+
7266+ else {
7267+ if (!yyg->yy_did_buffer_switch_on_eof)
7268+ YY_NEW_FILE;
7269+ }
7270+ break;
7271+ }
7272+
7273+ case EOB_ACT_CONTINUE_SCAN:
7274+ yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
7275+
7276+ yy_current_state = yy_get_previous_state(yyscanner);
7277+
7278+ yy_cp = yyg->yy_c_buf_p;
7279+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
7280+ goto yy_match;
7281+
7282+ case EOB_ACT_LAST_MATCH:
7283+ yyg->yy_c_buf_p = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
7284+
7285+ yy_current_state = yy_get_previous_state(yyscanner);
7286+
7287+ yy_cp = yyg->yy_c_buf_p;
7288+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
7289+ goto yy_find_action;
7290+ }
7291+ break;
7292+ }
7293+
7294+ default:
7295+ YY_FATAL_ERROR("fatal flex scanner internal error--no action found");
7296+ } /* end of action switch */
7297+ } /* end of scanning one token */
7298+ } /* end of user's declarations */
7299 } /* end of tsconfiglex */
7300
7301 /* yy_get_next_buffer - try to read in a new buffer
7302@@ -1128,168 +1043,149 @@ case YY_STATE_EOF(bad):
7303 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
7304 * EOB_ACT_END_OF_FILE - end of file
7305 */
7306-static int yy_get_next_buffer (yyscan_t yyscanner)
7307+static int
7308+yy_get_next_buffer(yyscan_t yyscanner)
7309 {
7310- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
7311- char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
7312- char *source = yyg->yytext_ptr;
7313- yy_size_t number_to_move, i;
7314- int ret_val;
7315-
7316- if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
7317- YY_FATAL_ERROR(
7318- "fatal flex scanner internal error--end of buffer missed" );
7319-
7320- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
7321- { /* Don't try to fill the buffer, so this is an EOF. */
7322- if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
7323- {
7324- /* We matched a single character, the EOB, so
7325- * treat this as a final EOF.
7326- */
7327- return EOB_ACT_END_OF_FILE;
7328- }
7329-
7330- else
7331- {
7332- /* We matched some text prior to the EOB, first
7333- * process it.
7334- */
7335- return EOB_ACT_LAST_MATCH;
7336- }
7337- }
7338-
7339- /* Try to read more data. */
7340-
7341- /* First move last chars to start of buffer. */
7342- number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
7343-
7344- for ( i = 0; i < number_to_move; ++i )
7345- *(dest++) = *(source++);
7346-
7347- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
7348- /* don't do the read, it's not guaranteed to return an EOF,
7349- * just force an EOF
7350- */
7351- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
7352-
7353- else
7354- {
7355- int num_to_read =
7356- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
7357-
7358- while ( num_to_read <= 0 )
7359- { /* Not enough room in the buffer - grow it. */
7360-
7361- /* just a shorter name for the current buffer */
7362- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
7363-
7364- int yy_c_buf_p_offset =
7365- (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
7366-
7367- if ( b->yy_is_our_buffer )
7368- {
7369- yy_size_t new_size = b->yy_buf_size * 2;
7370-
7371- if ( new_size <= 0 )
7372- b->yy_buf_size += b->yy_buf_size / 8;
7373- else
7374- b->yy_buf_size *= 2;
7375-
7376- b->yy_ch_buf = (char *)
7377- /* Include room in for 2 EOB chars. */
7378- tsconfigrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
7379- }
7380- else
7381- /* Can't grow it, we don't own it. */
7382- b->yy_ch_buf = 0;
7383-
7384- if ( ! b->yy_ch_buf )
7385- YY_FATAL_ERROR(
7386- "fatal error - scanner input buffer overflow" );
7387-
7388- yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
7389-
7390- num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
7391- number_to_move - 1;
7392-
7393- }
7394-
7395- if ( num_to_read > YY_READ_BUF_SIZE )
7396- num_to_read = YY_READ_BUF_SIZE;
7397-
7398- /* Read in more data. */
7399- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
7400- yyg->yy_n_chars, num_to_read );
7401-
7402- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
7403- }
7404-
7405- if ( yyg->yy_n_chars == 0 )
7406- {
7407- if ( number_to_move == YY_MORE_ADJ )
7408- {
7409- ret_val = EOB_ACT_END_OF_FILE;
7410- tsconfigrestart(yyin ,yyscanner);
7411- }
7412-
7413- else
7414- {
7415- ret_val = EOB_ACT_LAST_MATCH;
7416- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
7417- YY_BUFFER_EOF_PENDING;
7418- }
7419- }
7420-
7421- else
7422- ret_val = EOB_ACT_CONTINUE_SCAN;
7423-
7424- if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
7425- /* Extend the array by 50%, plus the number we really need. */
7426- yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
7427- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) tsconfigrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
7428- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
7429- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
7430- }
7431-
7432- yyg->yy_n_chars += number_to_move;
7433- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
7434- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
7435-
7436- yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
7437+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
7438+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
7439+ char *source = yyg->yytext_ptr;
7440+ yy_size_t number_to_move, i;
7441+ int ret_val;
7442+
7443+ if (yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1])
7444+ YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed");
7445+
7446+ if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0) { /* Don't try to fill the buffer, so this is an EOF. */
7447+ if (yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1) {
7448+ /* We matched a single character, the EOB, so
7449+ * treat this as a final EOF.
7450+ */
7451+ return EOB_ACT_END_OF_FILE;
7452+ }
7453+
7454+ else {
7455+ /* We matched some text prior to the EOB, first
7456+ * process it.
7457+ */
7458+ return EOB_ACT_LAST_MATCH;
7459+ }
7460+ }
7461+
7462+ /* Try to read more data. */
7463+
7464+ /* First move last chars to start of buffer. */
7465+ number_to_move = (yy_size_t)(yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
7466+
7467+ for (i = 0; i < number_to_move; ++i)
7468+ *(dest++) = *(source++);
7469
7470- return ret_val;
7471+ if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING)
7472+ /* don't do the read, it's not guaranteed to return an EOF,
7473+ * just force an EOF
7474+ */
7475+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
7476+
7477+ else {
7478+ int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
7479+
7480+ while (num_to_read <= 0) { /* Not enough room in the buffer - grow it. */
7481+
7482+ /* just a shorter name for the current buffer */
7483+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
7484+
7485+ int yy_c_buf_p_offset = (int)(yyg->yy_c_buf_p - b->yy_ch_buf);
7486+
7487+ if (b->yy_is_our_buffer) {
7488+ yy_size_t new_size = b->yy_buf_size * 2;
7489+
7490+ if (new_size <= 0)
7491+ b->yy_buf_size += b->yy_buf_size / 8;
7492+ else
7493+ b->yy_buf_size *= 2;
7494+
7495+ b->yy_ch_buf = (char *)
7496+ /* Include room in for 2 EOB chars. */
7497+ tsconfigrealloc((void *)b->yy_ch_buf, b->yy_buf_size + 2, yyscanner);
7498+ } else
7499+ /* Can't grow it, we don't own it. */
7500+ b->yy_ch_buf = 0;
7501+
7502+ if (!b->yy_ch_buf)
7503+ YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
7504+
7505+ yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
7506+
7507+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
7508+ }
7509+
7510+ if (num_to_read > YY_READ_BUF_SIZE)
7511+ num_to_read = YY_READ_BUF_SIZE;
7512+
7513+ /* Read in more data. */
7514+ YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), yyg->yy_n_chars, num_to_read);
7515+
7516+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
7517+ }
7518+
7519+ if (yyg->yy_n_chars == 0) {
7520+ if (number_to_move == YY_MORE_ADJ) {
7521+ ret_val = EOB_ACT_END_OF_FILE;
7522+ tsconfigrestart(yyin, yyscanner);
7523+ }
7524+
7525+ else {
7526+ ret_val = EOB_ACT_LAST_MATCH;
7527+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING;
7528+ }
7529+ }
7530+
7531+ else
7532+ ret_val = EOB_ACT_CONTINUE_SCAN;
7533+
7534+ if ((yy_size_t)(yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
7535+ /* Extend the array by 50%, plus the number we really need. */
7536+ yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
7537+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *)tsconfigrealloc((void *)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size, yyscanner);
7538+ if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
7539+ YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
7540+ }
7541+
7542+ yyg->yy_n_chars += number_to_move;
7543+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
7544+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
7545+
7546+ yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
7547+
7548+ return ret_val;
7549 }
7550
7551 /* yy_get_previous_state - get the state just before the EOB char was reached */
7552
7553- static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
7554+static yy_state_type
7555+yy_get_previous_state(yyscan_t yyscanner)
7556 {
7557- yy_state_type yy_current_state;
7558- char *yy_cp;
7559- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
7560-
7561- yy_current_state = yyg->yy_start;
7562- yy_current_state += YY_AT_BOL();
7563-
7564- for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
7565- {
7566- YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
7567- if ( yy_accept[yy_current_state] )
7568- {
7569- yyg->yy_last_accepting_state = yy_current_state;
7570- yyg->yy_last_accepting_cpos = yy_cp;
7571- }
7572- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
7573- {
7574- yy_current_state = (int) yy_def[yy_current_state];
7575- if ( yy_current_state >= 48 )
7576- yy_c = yy_meta[(unsigned int) yy_c];
7577- }
7578- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
7579- }
7580-
7581- return yy_current_state;
7582+ yy_state_type yy_current_state;
7583+ char *yy_cp;
7584+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
7585+
7586+ yy_current_state = yyg->yy_start;
7587+ yy_current_state += YY_AT_BOL();
7588+
7589+ for (yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp) {
7590+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
7591+ if (yy_accept[yy_current_state]) {
7592+ yyg->yy_last_accepting_state = yy_current_state;
7593+ yyg->yy_last_accepting_cpos = yy_cp;
7594+ }
7595+ while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
7596+ yy_current_state = (int)yy_def[yy_current_state];
7597+ if (yy_current_state >= 48)
7598+ yy_c = yy_meta[(unsigned int)yy_c];
7599+ }
7600+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c];
7601+ }
7602+
7603+ return yy_current_state;
7604 }
7605
7606 /* yy_try_NUL_trans - try to make a transition on the NUL character
7607@@ -1297,29 +1193,28 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
7608 * synopsis
7609 * next_state = yy_try_NUL_trans( current_state );
7610 */
7611- static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
7612+static yy_state_type
7613+yy_try_NUL_trans(yy_state_type yy_current_state, yyscan_t yyscanner)
7614 {
7615- int yy_is_jam;
7616- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
7617- char *yy_cp = yyg->yy_c_buf_p;
7618-
7619- YY_CHAR yy_c = 1;
7620- if ( yy_accept[yy_current_state] )
7621- {
7622- yyg->yy_last_accepting_state = yy_current_state;
7623- yyg->yy_last_accepting_cpos = yy_cp;
7624- }
7625- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
7626- {
7627- yy_current_state = (int) yy_def[yy_current_state];
7628- if ( yy_current_state >= 48 )
7629- yy_c = yy_meta[(unsigned int) yy_c];
7630- }
7631- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
7632- yy_is_jam = (yy_current_state == 47);
7633-
7634- (void)yyg;
7635- return yy_is_jam ? 0 : yy_current_state;
7636+ int yy_is_jam;
7637+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner; /* This var may be unused depending upon options. */
7638+ char *yy_cp = yyg->yy_c_buf_p;
7639+
7640+ YY_CHAR yy_c = 1;
7641+ if (yy_accept[yy_current_state]) {
7642+ yyg->yy_last_accepting_state = yy_current_state;
7643+ yyg->yy_last_accepting_cpos = yy_cp;
7644+ }
7645+ while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state) {
7646+ yy_current_state = (int)yy_def[yy_current_state];
7647+ if (yy_current_state >= 48)
7648+ yy_c = yy_meta[(unsigned int)yy_c];
7649+ }
7650+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c];
7651+ yy_is_jam = (yy_current_state == 47);
7652+
7653+ (void)yyg;
7654+ return yy_is_jam ? 0 : yy_current_state;
7655 }
7656
7657 #ifndef YY_NO_UNPUT
7658@@ -1328,143 +1223,142 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
7659
7660 #ifndef YY_NO_INPUT
7661 #ifdef __cplusplus
7662- static int yyinput (yyscan_t yyscanner)
7663+static int
7664+yyinput(yyscan_t yyscanner)
7665 #else
7666- static int input (yyscan_t yyscanner)
7667+static int
7668+input(yyscan_t yyscanner)
7669 #endif
7670
7671 {
7672- int c;
7673- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
7674-
7675- *yyg->yy_c_buf_p = yyg->yy_hold_char;
7676-
7677- if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
7678- {
7679- /* yy_c_buf_p now points to the character we want to return.
7680- * If this occurs *before* the EOB characters, then it's a
7681- * valid NUL; if not, then we've hit the end of the buffer.
7682- */
7683- if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
7684- /* This was really a NUL. */
7685- *yyg->yy_c_buf_p = '\0';
7686-
7687- else
7688- { /* need more input */
7689- yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
7690- ++yyg->yy_c_buf_p;
7691-
7692- switch ( yy_get_next_buffer( yyscanner ) )
7693- {
7694- case EOB_ACT_LAST_MATCH:
7695- /* This happens because yy_g_n_b()
7696- * sees that we've accumulated a
7697- * token and flags that we need to
7698- * try matching the token before
7699- * proceeding. But for input(),
7700- * there's no matching to consider.
7701- * So convert the EOB_ACT_LAST_MATCH
7702- * to EOB_ACT_END_OF_FILE.
7703- */
7704-
7705- /* Reset buffer status. */
7706- tsconfigrestart(yyin ,yyscanner);
7707-
7708- /*FALLTHROUGH*/
7709-
7710- case EOB_ACT_END_OF_FILE:
7711- {
7712- if ( tsconfigwrap(yyscanner ) )
7713- return EOF;
7714-
7715- if ( ! yyg->yy_did_buffer_switch_on_eof )
7716- YY_NEW_FILE;
7717+ int c;
7718+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
7719+
7720+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
7721+
7722+ if (*yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR) {
7723+ /* yy_c_buf_p now points to the character we want to return.
7724+ * If this occurs *before* the EOB characters, then it's a
7725+ * valid NUL; if not, then we've hit the end of the buffer.
7726+ */
7727+ if (yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars])
7728+ /* This was really a NUL. */
7729+ *yyg->yy_c_buf_p = '\0';
7730+
7731+ else { /* need more input */
7732+ yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
7733+ ++yyg->yy_c_buf_p;
7734+
7735+ switch (yy_get_next_buffer(yyscanner)) {
7736+ case EOB_ACT_LAST_MATCH:
7737+ /* This happens because yy_g_n_b()
7738+ * sees that we've accumulated a
7739+ * token and flags that we need to
7740+ * try matching the token before
7741+ * proceeding. But for input(),
7742+ * there's no matching to consider.
7743+ * So convert the EOB_ACT_LAST_MATCH
7744+ * to EOB_ACT_END_OF_FILE.
7745+ */
7746+
7747+ /* Reset buffer status. */
7748+ tsconfigrestart(yyin, yyscanner);
7749+
7750+ /*FALLTHROUGH*/
7751+
7752+ case EOB_ACT_END_OF_FILE: {
7753+ if (tsconfigwrap(yyscanner))
7754+ return EOF;
7755+
7756+ if (!yyg->yy_did_buffer_switch_on_eof)
7757+ YY_NEW_FILE;
7758 #ifdef __cplusplus
7759- return yyinput(yyscanner);
7760+ return yyinput(yyscanner);
7761 #else
7762- return input(yyscanner);
7763+ return input(yyscanner);
7764 #endif
7765- }
7766+ }
7767
7768- case EOB_ACT_CONTINUE_SCAN:
7769- yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
7770- break;
7771- }
7772- }
7773- }
7774+ case EOB_ACT_CONTINUE_SCAN:
7775+ yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
7776+ break;
7777+ }
7778+ }
7779+ }
7780
7781- c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
7782- *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
7783- yyg->yy_hold_char = *++yyg->yy_c_buf_p;
7784+ c = *(unsigned char *)yyg->yy_c_buf_p; /* cast for 8-bit char's */
7785+ *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
7786+ yyg->yy_hold_char = *++yyg->yy_c_buf_p;
7787
7788- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
7789+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
7790
7791- return c;
7792+ return c;
7793 }
7794-#endif /* ifndef YY_NO_INPUT */
7795+#endif /* ifndef YY_NO_INPUT */
7796
7797 /** Immediately switch to a different input stream.
7798 * @param input_file A readable stream.
7799 * @param yyscanner The scanner object.
7800 * @note This function does not reset the start condition to @c INITIAL .
7801 */
7802- void tsconfigrestart (FILE * input_file , yyscan_t yyscanner)
7803+void
7804+tsconfigrestart(FILE *input_file, yyscan_t yyscanner)
7805 {
7806- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
7807+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
7808
7809- if ( ! YY_CURRENT_BUFFER ){
7810- tsconfigensure_buffer_stack (yyscanner);
7811- YY_CURRENT_BUFFER_LVALUE =
7812- tsconfig_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
7813- }
7814+ if (!YY_CURRENT_BUFFER) {
7815+ tsconfigensure_buffer_stack(yyscanner);
7816+ YY_CURRENT_BUFFER_LVALUE = tsconfig_create_buffer(yyin, YY_BUF_SIZE, yyscanner);
7817+ }
7818
7819- tsconfig_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
7820- tsconfig_load_buffer_state(yyscanner );
7821+ tsconfig_init_buffer(YY_CURRENT_BUFFER, input_file, yyscanner);
7822+ tsconfig_load_buffer_state(yyscanner);
7823 }
7824
7825 /** Switch to a different input buffer.
7826 * @param new_buffer The new input buffer.
7827 * @param yyscanner The scanner object.
7828 */
7829- void tsconfig_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
7830+void
7831+tsconfig_switch_to_buffer(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
7832 {
7833- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
7834+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
7835+
7836+ /* TODO. We should be able to replace this entire function body
7837+ * with
7838+ * tsconfigpop_buffer_state();
7839+ * tsconfigpush_buffer_state(new_buffer);
7840+ */
7841+ tsconfigensure_buffer_stack(yyscanner);
7842+ if (YY_CURRENT_BUFFER == new_buffer)
7843+ return;
7844+
7845+ if (YY_CURRENT_BUFFER) {
7846+ /* Flush out information for old buffer. */
7847+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
7848+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
7849+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
7850+ }
7851
7852- /* TODO. We should be able to replace this entire function body
7853- * with
7854- * tsconfigpop_buffer_state();
7855- * tsconfigpush_buffer_state(new_buffer);
7856- */
7857- tsconfigensure_buffer_stack (yyscanner);
7858- if ( YY_CURRENT_BUFFER == new_buffer )
7859- return;
7860-
7861- if ( YY_CURRENT_BUFFER )
7862- {
7863- /* Flush out information for old buffer. */
7864- *yyg->yy_c_buf_p = yyg->yy_hold_char;
7865- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
7866- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
7867- }
7868-
7869- YY_CURRENT_BUFFER_LVALUE = new_buffer;
7870- tsconfig_load_buffer_state(yyscanner );
7871-
7872- /* We don't actually know whether we did this switch during
7873- * EOF (tsconfigwrap()) processing, but the only time this flag
7874- * is looked at is after tsconfigwrap() is called, so it's safe
7875- * to go ahead and always set it.
7876- */
7877- yyg->yy_did_buffer_switch_on_eof = 1;
7878+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
7879+ tsconfig_load_buffer_state(yyscanner);
7880+
7881+ /* We don't actually know whether we did this switch during
7882+ * EOF (tsconfigwrap()) processing, but the only time this flag
7883+ * is looked at is after tsconfigwrap() is called, so it's safe
7884+ * to go ahead and always set it.
7885+ */
7886+ yyg->yy_did_buffer_switch_on_eof = 1;
7887 }
7888
7889-static void tsconfig_load_buffer_state (yyscan_t yyscanner)
7890+static void
7891+tsconfig_load_buffer_state(yyscan_t yyscanner)
7892 {
7893- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
7894- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
7895- yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
7896- yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
7897- yyg->yy_hold_char = *yyg->yy_c_buf_p;
7898+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
7899+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
7900+ yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
7901+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
7902+ yyg->yy_hold_char = *yyg->yy_c_buf_p;
7903 }
7904
7905 /** Allocate and initialize an input buffer state.
7906@@ -1473,105 +1367,109 @@ static void tsconfig_load_buffer_state (yyscan_t yyscanner)
7907 * @param yyscanner The scanner object.
7908 * @return the allocated buffer state.
7909 */
7910- YY_BUFFER_STATE tsconfig_create_buffer (FILE * file, int size , yyscan_t yyscanner)
7911+YY_BUFFER_STATE
7912+tsconfig_create_buffer(FILE *file, int size, yyscan_t yyscanner)
7913 {
7914- YY_BUFFER_STATE b;
7915+ YY_BUFFER_STATE b;
7916
7917- b = (YY_BUFFER_STATE) tsconfigalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
7918- if ( ! b )
7919- YY_FATAL_ERROR( "out of dynamic memory in tsconfig_create_buffer()" );
7920+ b = (YY_BUFFER_STATE)tsconfigalloc(sizeof(struct yy_buffer_state), yyscanner);
7921+ if (!b)
7922+ YY_FATAL_ERROR("out of dynamic memory in tsconfig_create_buffer()");
7923
7924- b->yy_buf_size = (yy_size_t)size;
7925+ b->yy_buf_size = (yy_size_t)size;
7926
7927- /* yy_ch_buf has to be 2 characters longer than the size given because
7928- * we need to put in 2 end-of-buffer characters.
7929- */
7930- b->yy_ch_buf = (char *) tsconfigalloc(b->yy_buf_size + 2 ,yyscanner );
7931- if ( ! b->yy_ch_buf )
7932- YY_FATAL_ERROR( "out of dynamic memory in tsconfig_create_buffer()" );
7933+ /* yy_ch_buf has to be 2 characters longer than the size given because
7934+ * we need to put in 2 end-of-buffer characters.
7935+ */
7936+ b->yy_ch_buf = (char *)tsconfigalloc(b->yy_buf_size + 2, yyscanner);
7937+ if (!b->yy_ch_buf)
7938+ YY_FATAL_ERROR("out of dynamic memory in tsconfig_create_buffer()");
7939
7940- b->yy_is_our_buffer = 1;
7941+ b->yy_is_our_buffer = 1;
7942
7943- tsconfig_init_buffer(b,file ,yyscanner);
7944+ tsconfig_init_buffer(b, file, yyscanner);
7945
7946- return b;
7947+ return b;
7948 }
7949
7950 /** Destroy the buffer.
7951 * @param b a buffer created with tsconfig_create_buffer()
7952 * @param yyscanner The scanner object.
7953 */
7954- void tsconfig_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
7955+void
7956+tsconfig_delete_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner)
7957 {
7958- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
7959+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
7960
7961- if ( ! b )
7962- return;
7963+ if (!b)
7964+ return;
7965
7966- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
7967- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
7968+ if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */
7969+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE)0;
7970
7971- if ( b->yy_is_our_buffer )
7972- tsconfigfree((void *) b->yy_ch_buf ,yyscanner );
7973+ if (b->yy_is_our_buffer)
7974+ tsconfigfree((void *)b->yy_ch_buf, yyscanner);
7975
7976- tsconfigfree((void *) b ,yyscanner );
7977+ tsconfigfree((void *)b, yyscanner);
7978 }
7979
7980 /* Initializes or reinitializes a buffer.
7981 * This function is sometimes called more than once on the same buffer,
7982 * such as during a tsconfigrestart() or at EOF.
7983 */
7984- static void tsconfig_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
7985+static void
7986+tsconfig_init_buffer(YY_BUFFER_STATE b, FILE *file, yyscan_t yyscanner)
7987
7988 {
7989- int oerrno = errno;
7990- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
7991+ int oerrno = errno;
7992+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
7993
7994- tsconfig_flush_buffer(b ,yyscanner);
7995+ tsconfig_flush_buffer(b, yyscanner);
7996
7997- b->yy_input_file = file;
7998- b->yy_fill_buffer = 1;
7999+ b->yy_input_file = file;
8000+ b->yy_fill_buffer = 1;
8001
8002- /* If b is the current buffer, then tsconfig_init_buffer was _probably_
8003- * called from tsconfigrestart() or through yy_get_next_buffer.
8004- * In that case, we don't want to reset the lineno or column.
8005- */
8006- if (b != YY_CURRENT_BUFFER){
8007- b->yy_bs_lineno = 1;
8008- b->yy_bs_column = 0;
8009- }
8010+ /* If b is the current buffer, then tsconfig_init_buffer was _probably_
8011+ * called from tsconfigrestart() or through yy_get_next_buffer.
8012+ * In that case, we don't want to reset the lineno or column.
8013+ */
8014+ if (b != YY_CURRENT_BUFFER) {
8015+ b->yy_bs_lineno = 1;
8016+ b->yy_bs_column = 0;
8017+ }
8018
8019- b->yy_is_interactive = 0;
8020+ b->yy_is_interactive = 0;
8021
8022- errno = oerrno;
8023+ errno = oerrno;
8024 }
8025
8026 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
8027 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
8028 * @param yyscanner The scanner object.
8029 */
8030- void tsconfig_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
8031+void
8032+tsconfig_flush_buffer(YY_BUFFER_STATE b, yyscan_t yyscanner)
8033 {
8034- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8035- if ( ! b )
8036- return;
8037+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8038+ if (!b)
8039+ return;
8040
8041- b->yy_n_chars = 0;
8042+ b->yy_n_chars = 0;
8043
8044- /* We always need two end-of-buffer characters. The first causes
8045- * a transition to the end-of-buffer state. The second causes
8046- * a jam in that state.
8047- */
8048- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
8049- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
8050+ /* We always need two end-of-buffer characters. The first causes
8051+ * a transition to the end-of-buffer state. The second causes
8052+ * a jam in that state.
8053+ */
8054+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
8055+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
8056
8057- b->yy_buf_pos = &b->yy_ch_buf[0];
8058+ b->yy_buf_pos = &b->yy_ch_buf[0];
8059
8060- b->yy_at_bol = 1;
8061- b->yy_buffer_status = YY_BUFFER_NEW;
8062+ b->yy_at_bol = 1;
8063+ b->yy_buffer_status = YY_BUFFER_NEW;
8064
8065- if ( b == YY_CURRENT_BUFFER )
8066- tsconfig_load_buffer_state(yyscanner );
8067+ if (b == YY_CURRENT_BUFFER)
8068+ tsconfig_load_buffer_state(yyscanner);
8069 }
8070
8071 /** Pushes the new state onto the stack. The new state becomes
8072@@ -1580,99 +1478,95 @@ static void tsconfig_load_buffer_state (yyscan_t yyscanner)
8073 * @param new_buffer The new state.
8074 * @param yyscanner The scanner object.
8075 */
8076-void tsconfigpush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
8077+void
8078+tsconfigpush_buffer_state(YY_BUFFER_STATE new_buffer, yyscan_t yyscanner)
8079 {
8080- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8081- if (new_buffer == NULL)
8082- return;
8083-
8084- tsconfigensure_buffer_stack(yyscanner);
8085-
8086- /* This block is copied from tsconfig_switch_to_buffer. */
8087- if ( YY_CURRENT_BUFFER )
8088- {
8089- /* Flush out information for old buffer. */
8090- *yyg->yy_c_buf_p = yyg->yy_hold_char;
8091- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
8092- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
8093- }
8094-
8095- /* Only push if top exists. Otherwise, replace top. */
8096- if (YY_CURRENT_BUFFER)
8097- yyg->yy_buffer_stack_top++;
8098- YY_CURRENT_BUFFER_LVALUE = new_buffer;
8099-
8100- /* copied from tsconfig_switch_to_buffer. */
8101- tsconfig_load_buffer_state(yyscanner );
8102- yyg->yy_did_buffer_switch_on_eof = 1;
8103+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8104+ if (new_buffer == NULL)
8105+ return;
8106+
8107+ tsconfigensure_buffer_stack(yyscanner);
8108+
8109+ /* This block is copied from tsconfig_switch_to_buffer. */
8110+ if (YY_CURRENT_BUFFER) {
8111+ /* Flush out information for old buffer. */
8112+ *yyg->yy_c_buf_p = yyg->yy_hold_char;
8113+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
8114+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
8115+ }
8116+
8117+ /* Only push if top exists. Otherwise, replace top. */
8118+ if (YY_CURRENT_BUFFER)
8119+ yyg->yy_buffer_stack_top++;
8120+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
8121+
8122+ /* copied from tsconfig_switch_to_buffer. */
8123+ tsconfig_load_buffer_state(yyscanner);
8124+ yyg->yy_did_buffer_switch_on_eof = 1;
8125 }
8126
8127 /** Removes and deletes the top of the stack, if present.
8128 * The next element becomes the new top.
8129 * @param yyscanner The scanner object.
8130 */
8131-void tsconfigpop_buffer_state (yyscan_t yyscanner)
8132+void
8133+tsconfigpop_buffer_state(yyscan_t yyscanner)
8134 {
8135- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8136- if (!YY_CURRENT_BUFFER)
8137- return;
8138-
8139- tsconfig_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
8140- YY_CURRENT_BUFFER_LVALUE = NULL;
8141- if (yyg->yy_buffer_stack_top > 0)
8142- --yyg->yy_buffer_stack_top;
8143-
8144- if (YY_CURRENT_BUFFER) {
8145- tsconfig_load_buffer_state(yyscanner );
8146- yyg->yy_did_buffer_switch_on_eof = 1;
8147- }
8148+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8149+ if (!YY_CURRENT_BUFFER)
8150+ return;
8151+
8152+ tsconfig_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8153+ YY_CURRENT_BUFFER_LVALUE = NULL;
8154+ if (yyg->yy_buffer_stack_top > 0)
8155+ --yyg->yy_buffer_stack_top;
8156+
8157+ if (YY_CURRENT_BUFFER) {
8158+ tsconfig_load_buffer_state(yyscanner);
8159+ yyg->yy_did_buffer_switch_on_eof = 1;
8160+ }
8161 }
8162
8163 /* Allocates the stack if it does not exist.
8164 * Guarantees space for at least one push.
8165 */
8166-static void tsconfigensure_buffer_stack (yyscan_t yyscanner)
8167+static void
8168+tsconfigensure_buffer_stack(yyscan_t yyscanner)
8169 {
8170- yy_size_t num_to_alloc;
8171- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8172+ yy_size_t num_to_alloc;
8173+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8174
8175- if (!yyg->yy_buffer_stack) {
8176+ if (!yyg->yy_buffer_stack) {
8177+ /* First allocation is just for 2 elements, since we don't know if this
8178+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
8179+ * immediate realloc on the next call.
8180+ */
8181+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
8182+ yyg->yy_buffer_stack = (struct yy_buffer_state **)tsconfigalloc(num_to_alloc * sizeof(struct yy_buffer_state *), yyscanner);
8183+ if (!yyg->yy_buffer_stack)
8184+ YY_FATAL_ERROR("out of dynamic memory in tsconfigensure_buffer_stack()");
8185
8186- /* First allocation is just for 2 elements, since we don't know if this
8187- * scanner will even need a stack. We use 2 instead of 1 to avoid an
8188- * immediate realloc on the next call.
8189- */
8190- num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
8191- yyg->yy_buffer_stack = (struct yy_buffer_state**)tsconfigalloc
8192- (num_to_alloc * sizeof(struct yy_buffer_state*)
8193- , yyscanner);
8194- if ( ! yyg->yy_buffer_stack )
8195- YY_FATAL_ERROR( "out of dynamic memory in tsconfigensure_buffer_stack()" );
8196-
8197- memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
8198-
8199- yyg->yy_buffer_stack_max = num_to_alloc;
8200- yyg->yy_buffer_stack_top = 0;
8201- return;
8202- }
8203-
8204- if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
8205-
8206- /* Increase the buffer to prepare for a possible push. */
8207- yy_size_t grow_size = 8 /* arbitrary grow size */;
8208-
8209- num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
8210- yyg->yy_buffer_stack = (struct yy_buffer_state**)tsconfigrealloc
8211- (yyg->yy_buffer_stack,
8212- num_to_alloc * sizeof(struct yy_buffer_state*)
8213- , yyscanner);
8214- if ( ! yyg->yy_buffer_stack )
8215- YY_FATAL_ERROR( "out of dynamic memory in tsconfigensure_buffer_stack()" );
8216-
8217- /* zero only the new slots.*/
8218- memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
8219- yyg->yy_buffer_stack_max = num_to_alloc;
8220- }
8221+ memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state *));
8222+
8223+ yyg->yy_buffer_stack_max = num_to_alloc;
8224+ yyg->yy_buffer_stack_top = 0;
8225+ return;
8226+ }
8227+
8228+ if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1) {
8229+ /* Increase the buffer to prepare for a possible push. */
8230+ yy_size_t grow_size = 8 /* arbitrary grow size */;
8231+
8232+ num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
8233+ yyg->yy_buffer_stack =
8234+ (struct yy_buffer_state **)tsconfigrealloc(yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state *), yyscanner);
8235+ if (!yyg->yy_buffer_stack)
8236+ YY_FATAL_ERROR("out of dynamic memory in tsconfigensure_buffer_stack()");
8237+
8238+ /* zero only the new slots.*/
8239+ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state *));
8240+ yyg->yy_buffer_stack_max = num_to_alloc;
8241+ }
8242 }
8243
8244 /** Setup the input buffer state to scan directly from a user-specified character buffer.
8245@@ -1681,33 +1575,32 @@ static void tsconfigensure_buffer_stack (yyscan_t yyscanner)
8246 * @param yyscanner The scanner object.
8247 * @return the newly allocated buffer state object.
8248 */
8249-YY_BUFFER_STATE tsconfig_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
8250+YY_BUFFER_STATE
8251+tsconfig_scan_buffer(char *base, yy_size_t size, yyscan_t yyscanner)
8252 {
8253- YY_BUFFER_STATE b;
8254-
8255- if ( size < 2 ||
8256- base[size-2] != YY_END_OF_BUFFER_CHAR ||
8257- base[size-1] != YY_END_OF_BUFFER_CHAR )
8258- /* They forgot to leave room for the EOB's. */
8259- return 0;
8260-
8261- b = (YY_BUFFER_STATE) tsconfigalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
8262- if ( ! b )
8263- YY_FATAL_ERROR( "out of dynamic memory in tsconfig_scan_buffer()" );
8264-
8265- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
8266- b->yy_buf_pos = b->yy_ch_buf = base;
8267- b->yy_is_our_buffer = 0;
8268- b->yy_input_file = 0;
8269- b->yy_n_chars = b->yy_buf_size;
8270- b->yy_is_interactive = 0;
8271- b->yy_at_bol = 1;
8272- b->yy_fill_buffer = 0;
8273- b->yy_buffer_status = YY_BUFFER_NEW;
8274-
8275- tsconfig_switch_to_buffer(b ,yyscanner );
8276-
8277- return b;
8278+ YY_BUFFER_STATE b;
8279+
8280+ if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR || base[size - 1] != YY_END_OF_BUFFER_CHAR)
8281+ /* They forgot to leave room for the EOB's. */
8282+ return 0;
8283+
8284+ b = (YY_BUFFER_STATE)tsconfigalloc(sizeof(struct yy_buffer_state), yyscanner);
8285+ if (!b)
8286+ YY_FATAL_ERROR("out of dynamic memory in tsconfig_scan_buffer()");
8287+
8288+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
8289+ b->yy_buf_pos = b->yy_ch_buf = base;
8290+ b->yy_is_our_buffer = 0;
8291+ b->yy_input_file = 0;
8292+ b->yy_n_chars = b->yy_buf_size;
8293+ b->yy_is_interactive = 0;
8294+ b->yy_at_bol = 1;
8295+ b->yy_fill_buffer = 0;
8296+ b->yy_buffer_status = YY_BUFFER_NEW;
8297+
8298+ tsconfig_switch_to_buffer(b, yyscanner);
8299+
8300+ return b;
8301 }
8302
8303 /** Setup the input buffer state to scan a string. The next call to tsconfiglex() will
8304@@ -1718,10 +1611,10 @@ YY_BUFFER_STATE tsconfig_scan_buffer (char * base, yy_size_t size , yyscan_t y
8305 * @note If you want to scan bytes that may contain NUL values, then use
8306 * tsconfig_scan_bytes() instead.
8307 */
8308-YY_BUFFER_STATE tsconfig_scan_string (yyconst char * yystr , yyscan_t yyscanner)
8309+YY_BUFFER_STATE
8310+tsconfig_scan_string(yyconst char *yystr, yyscan_t yyscanner)
8311 {
8312-
8313- return tsconfig_scan_bytes(yystr,strlen(yystr) ,yyscanner);
8314+ return tsconfig_scan_bytes(yystr, strlen(yystr), yyscanner);
8315 }
8316
8317 /** Setup the input buffer state to scan the given bytes. The next call to tsconfiglex() will
8318@@ -1731,177 +1624,187 @@ YY_BUFFER_STATE tsconfig_scan_string (yyconst char * yystr , yyscan_t yyscanner)
8319 * @param yyscanner The scanner object.
8320 * @return the newly allocated buffer state object.
8321 */
8322-YY_BUFFER_STATE tsconfig_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
8323+YY_BUFFER_STATE
8324+tsconfig_scan_bytes(yyconst char *yybytes, yy_size_t _yybytes_len, yyscan_t yyscanner)
8325 {
8326- YY_BUFFER_STATE b;
8327- char *buf;
8328- yy_size_t n;
8329- yy_size_t i;
8330+ YY_BUFFER_STATE b;
8331+ char *buf;
8332+ yy_size_t n;
8333+ yy_size_t i;
8334
8335- /* Get memory for full buffer, including space for trailing EOB's. */
8336- n = _yybytes_len + 2;
8337- buf = (char *) tsconfigalloc(n ,yyscanner );
8338- if ( ! buf )
8339- YY_FATAL_ERROR( "out of dynamic memory in tsconfig_scan_bytes()" );
8340+ /* Get memory for full buffer, including space for trailing EOB's. */
8341+ n = _yybytes_len + 2;
8342+ buf = (char *)tsconfigalloc(n, yyscanner);
8343+ if (!buf)
8344+ YY_FATAL_ERROR("out of dynamic memory in tsconfig_scan_bytes()");
8345
8346- for ( i = 0; i < _yybytes_len; ++i )
8347- buf[i] = yybytes[i];
8348+ for (i = 0; i < _yybytes_len; ++i)
8349+ buf[i] = yybytes[i];
8350
8351- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
8352+ buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR;
8353
8354- b = tsconfig_scan_buffer(buf,n ,yyscanner);
8355- if ( ! b )
8356- YY_FATAL_ERROR( "bad buffer in tsconfig_scan_bytes()" );
8357+ b = tsconfig_scan_buffer(buf, n, yyscanner);
8358+ if (!b)
8359+ YY_FATAL_ERROR("bad buffer in tsconfig_scan_bytes()");
8360
8361- /* It's okay to grow etc. this buffer, and we should throw it
8362- * away when we're done.
8363- */
8364- b->yy_is_our_buffer = 1;
8365+ /* It's okay to grow etc. this buffer, and we should throw it
8366+ * away when we're done.
8367+ */
8368+ b->yy_is_our_buffer = 1;
8369
8370- return b;
8371+ return b;
8372 }
8373
8374 #ifndef YY_EXIT_FAILURE
8375 #define YY_EXIT_FAILURE 2
8376 #endif
8377
8378-static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
8379+static void
8380+yy_fatal_error(yyconst char *msg, yyscan_t yyscanner)
8381 {
8382- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8383- (void)yyg;
8384- (void) fprintf( stderr, "%s\n", msg );
8385- exit( YY_EXIT_FAILURE );
8386+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8387+ (void)yyg;
8388+ (void)fprintf(stderr, "%s\n", msg);
8389+ exit(YY_EXIT_FAILURE);
8390 }
8391
8392 /* Redefine yyless() so it works in section 3 code. */
8393
8394 #undef yyless
8395-#define yyless(n) \
8396- do \
8397- { \
8398- /* Undo effects of setting up yytext. */ \
8399- yy_size_t yyless_macro_arg = (n); \
8400- YY_LESS_LINENO(yyless_macro_arg);\
8401- yytext[yyleng] = yyg->yy_hold_char; \
8402- yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
8403- yyg->yy_hold_char = *yyg->yy_c_buf_p; \
8404- *yyg->yy_c_buf_p = '\0'; \
8405- yyleng = yyless_macro_arg; \
8406- } \
8407- while ( 0 )
8408+#define yyless(n) \
8409+ do { \
8410+ /* Undo effects of setting up yytext. */ \
8411+ yy_size_t yyless_macro_arg = (n); \
8412+ YY_LESS_LINENO(yyless_macro_arg); \
8413+ yytext[yyleng] = yyg->yy_hold_char; \
8414+ yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
8415+ yyg->yy_hold_char = *yyg->yy_c_buf_p; \
8416+ *yyg->yy_c_buf_p = '\0'; \
8417+ yyleng = yyless_macro_arg; \
8418+ } while (0)
8419
8420 /* Accessor methods (get/set functions) to struct members. */
8421
8422 /** Get the user-defined data for this scanner.
8423 * @param yyscanner The scanner object.
8424 */
8425-YY_EXTRA_TYPE tsconfigget_extra (yyscan_t yyscanner)
8426+YY_EXTRA_TYPE
8427+tsconfigget_extra(yyscan_t yyscanner)
8428 {
8429- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8430- return yyextra;
8431+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8432+ return yyextra;
8433 }
8434
8435 /** Get the current line number.
8436 * @param yyscanner The scanner object.
8437 */
8438-int tsconfigget_lineno (yyscan_t yyscanner)
8439+int
8440+tsconfigget_lineno(yyscan_t yyscanner)
8441 {
8442- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8443+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8444
8445- if (! YY_CURRENT_BUFFER)
8446- return 0;
8447+ if (!YY_CURRENT_BUFFER)
8448+ return 0;
8449
8450- return yylineno;
8451+ return yylineno;
8452 }
8453
8454 /** Get the current column number.
8455 * @param yyscanner The scanner object.
8456 */
8457-int tsconfigget_column (yyscan_t yyscanner)
8458+int
8459+tsconfigget_column(yyscan_t yyscanner)
8460 {
8461- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8462+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8463
8464- if (! YY_CURRENT_BUFFER)
8465- return 0;
8466+ if (!YY_CURRENT_BUFFER)
8467+ return 0;
8468
8469- return yycolumn;
8470+ return yycolumn;
8471 }
8472
8473 /** Get the input stream.
8474 * @param yyscanner The scanner object.
8475 */
8476-FILE *tsconfigget_in (yyscan_t yyscanner)
8477+FILE *
8478+tsconfigget_in(yyscan_t yyscanner)
8479 {
8480- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8481- return yyin;
8482+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8483+ return yyin;
8484 }
8485
8486 /** Get the output stream.
8487 * @param yyscanner The scanner object.
8488 */
8489-FILE *tsconfigget_out (yyscan_t yyscanner)
8490+FILE *
8491+tsconfigget_out(yyscan_t yyscanner)
8492 {
8493- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8494- return yyout;
8495+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8496+ return yyout;
8497 }
8498
8499 /** Get the length of the current token.
8500 * @param yyscanner The scanner object.
8501 */
8502-yy_size_t tsconfigget_leng (yyscan_t yyscanner)
8503+yy_size_t
8504+tsconfigget_leng(yyscan_t yyscanner)
8505 {
8506- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8507- return yyleng;
8508+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8509+ return yyleng;
8510 }
8511
8512 /** Get the current token.
8513 * @param yyscanner The scanner object.
8514 */
8515
8516-char *tsconfigget_text (yyscan_t yyscanner)
8517+char *
8518+tsconfigget_text(yyscan_t yyscanner)
8519 {
8520- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8521- return yytext;
8522+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8523+ return yytext;
8524 }
8525
8526 /** Set the user-defined data. This data is never touched by the scanner.
8527 * @param user_defined The data to be associated with this scanner.
8528 * @param yyscanner The scanner object.
8529 */
8530-void tsconfigset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
8531+void
8532+tsconfigset_extra(YY_EXTRA_TYPE user_defined, yyscan_t yyscanner)
8533 {
8534- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8535- yyextra = user_defined ;
8536+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8537+ yyextra = user_defined;
8538 }
8539
8540 /** Set the current line number.
8541 * @param _line_number line number
8542 * @param yyscanner The scanner object.
8543 */
8544-void tsconfigset_lineno (int _line_number , yyscan_t yyscanner)
8545+void
8546+tsconfigset_lineno(int _line_number, yyscan_t yyscanner)
8547 {
8548- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8549+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8550
8551- /* lineno is only valid if an input buffer exists. */
8552- if (! YY_CURRENT_BUFFER )
8553- YY_FATAL_ERROR( "tsconfigset_lineno called with no buffer" );
8554+ /* lineno is only valid if an input buffer exists. */
8555+ if (!YY_CURRENT_BUFFER)
8556+ YY_FATAL_ERROR("tsconfigset_lineno called with no buffer");
8557
8558- yylineno = _line_number;
8559+ yylineno = _line_number;
8560 }
8561
8562 /** Set the current column.
8563 * @param _column_no column number
8564 * @param yyscanner The scanner object.
8565 */
8566-void tsconfigset_column (int _column_no , yyscan_t yyscanner)
8567+void
8568+tsconfigset_column(int _column_no, yyscan_t yyscanner)
8569 {
8570- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8571+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8572
8573- /* column is only valid if an input buffer exists. */
8574- if (! YY_CURRENT_BUFFER )
8575- YY_FATAL_ERROR( "tsconfigset_column called with no buffer" );
8576+ /* column is only valid if an input buffer exists. */
8577+ if (!YY_CURRENT_BUFFER)
8578+ YY_FATAL_ERROR("tsconfigset_column called with no buffer");
8579
8580- yycolumn = _column_no;
8581+ yycolumn = _column_no;
8582 }
8583
8584 /** Set the input stream. This does not discard the current
8585@@ -1910,42 +1813,48 @@ void tsconfigset_column (int _column_no , yyscan_t yyscanner)
8586 * @param yyscanner The scanner object.
8587 * @see tsconfig_switch_to_buffer
8588 */
8589-void tsconfigset_in (FILE * _in_str , yyscan_t yyscanner)
8590+void
8591+tsconfigset_in(FILE *_in_str, yyscan_t yyscanner)
8592 {
8593- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8594- yyin = _in_str ;
8595+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8596+ yyin = _in_str;
8597 }
8598
8599-void tsconfigset_out (FILE * _out_str , yyscan_t yyscanner)
8600+void
8601+tsconfigset_out(FILE *_out_str, yyscan_t yyscanner)
8602 {
8603- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8604- yyout = _out_str ;
8605+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8606+ yyout = _out_str;
8607 }
8608
8609-int tsconfigget_debug (yyscan_t yyscanner)
8610+int
8611+tsconfigget_debug(yyscan_t yyscanner)
8612 {
8613- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8614- return yy_flex_debug;
8615+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8616+ return yy_flex_debug;
8617 }
8618
8619-void tsconfigset_debug (int _bdebug , yyscan_t yyscanner)
8620+void
8621+tsconfigset_debug(int _bdebug, yyscan_t yyscanner)
8622 {
8623- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8624- yy_flex_debug = _bdebug ;
8625+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8626+ yy_flex_debug = _bdebug;
8627 }
8628
8629 /* Accessor methods for yylval and yylloc */
8630
8631-YYSTYPE * tsconfigget_lval (yyscan_t yyscanner)
8632+YYSTYPE *
8633+tsconfigget_lval(yyscan_t yyscanner)
8634 {
8635- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8636- return yylval;
8637+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8638+ return yylval;
8639 }
8640
8641-void tsconfigset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
8642+void
8643+tsconfigset_lval(YYSTYPE *yylval_param, yyscan_t yyscanner)
8644 {
8645- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8646- yylval = yylval_param;
8647+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8648+ yylval = yylval_param;
8649 }
8650
8651 /* User-visible API */
8652@@ -1955,25 +1864,26 @@ void tsconfigset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
8653 * That's why we explicitly handle the declaration, instead of using our macros.
8654 */
8655
8656-int tsconfiglex_init(yyscan_t* ptr_yy_globals)
8657+int
8658+tsconfiglex_init(yyscan_t *ptr_yy_globals)
8659
8660 {
8661- if (ptr_yy_globals == NULL){
8662- errno = EINVAL;
8663- return 1;
8664- }
8665+ if (ptr_yy_globals == NULL) {
8666+ errno = EINVAL;
8667+ return 1;
8668+ }
8669
8670- *ptr_yy_globals = (yyscan_t) tsconfigalloc ( sizeof( struct yyguts_t ), NULL );
8671+ *ptr_yy_globals = (yyscan_t)tsconfigalloc(sizeof(struct yyguts_t), NULL);
8672
8673- if (*ptr_yy_globals == NULL){
8674- errno = ENOMEM;
8675- return 1;
8676- }
8677+ if (*ptr_yy_globals == NULL) {
8678+ errno = ENOMEM;
8679+ return 1;
8680+ }
8681
8682- /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
8683- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
8684+ /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
8685+ memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t));
8686
8687- return yy_init_globals ( *ptr_yy_globals );
8688+ return yy_init_globals(*ptr_yy_globals);
8689 }
8690
8691 /* tsconfiglex_init_extra has the same functionality as tsconfiglex_init, but follows the
8692@@ -1984,95 +1894,98 @@ int tsconfiglex_init(yyscan_t* ptr_yy_globals)
8693 * the yyextra field.
8694 */
8695
8696-int tsconfiglex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
8697+int
8698+tsconfiglex_init_extra(YY_EXTRA_TYPE yy_user_defined, yyscan_t *ptr_yy_globals)
8699
8700 {
8701- struct yyguts_t dummy_yyguts;
8702+ struct yyguts_t dummy_yyguts;
8703
8704- tsconfigset_extra (yy_user_defined, &dummy_yyguts);
8705+ tsconfigset_extra(yy_user_defined, &dummy_yyguts);
8706
8707- if (ptr_yy_globals == NULL){
8708- errno = EINVAL;
8709- return 1;
8710- }
8711+ if (ptr_yy_globals == NULL) {
8712+ errno = EINVAL;
8713+ return 1;
8714+ }
8715
8716- *ptr_yy_globals = (yyscan_t) tsconfigalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
8717+ *ptr_yy_globals = (yyscan_t)tsconfigalloc(sizeof(struct yyguts_t), &dummy_yyguts);
8718
8719- if (*ptr_yy_globals == NULL){
8720- errno = ENOMEM;
8721- return 1;
8722- }
8723+ if (*ptr_yy_globals == NULL) {
8724+ errno = ENOMEM;
8725+ return 1;
8726+ }
8727
8728- /* By setting to 0xAA, we expose bugs in
8729- yy_init_globals. Leave at 0x00 for releases. */
8730- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
8731+ /* By setting to 0xAA, we expose bugs in
8732+ yy_init_globals. Leave at 0x00 for releases. */
8733+ memset(*ptr_yy_globals, 0x00, sizeof(struct yyguts_t));
8734
8735- tsconfigset_extra (yy_user_defined, *ptr_yy_globals);
8736+ tsconfigset_extra(yy_user_defined, *ptr_yy_globals);
8737
8738- return yy_init_globals ( *ptr_yy_globals );
8739+ return yy_init_globals(*ptr_yy_globals);
8740 }
8741
8742-static int yy_init_globals (yyscan_t yyscanner)
8743+static int
8744+yy_init_globals(yyscan_t yyscanner)
8745 {
8746- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8747- /* Initialization is the same as for the non-reentrant scanner.
8748- * This function is called from tsconfiglex_destroy(), so don't allocate here.
8749- */
8750-
8751- yyg->yy_buffer_stack = 0;
8752- yyg->yy_buffer_stack_top = 0;
8753- yyg->yy_buffer_stack_max = 0;
8754- yyg->yy_c_buf_p = (char *) 0;
8755- yyg->yy_init = 0;
8756- yyg->yy_start = 0;
8757-
8758- yyg->yy_start_stack_ptr = 0;
8759- yyg->yy_start_stack_depth = 0;
8760- yyg->yy_start_stack = NULL;
8761+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8762+ /* Initialization is the same as for the non-reentrant scanner.
8763+ * This function is called from tsconfiglex_destroy(), so don't allocate here.
8764+ */
8765+
8766+ yyg->yy_buffer_stack = 0;
8767+ yyg->yy_buffer_stack_top = 0;
8768+ yyg->yy_buffer_stack_max = 0;
8769+ yyg->yy_c_buf_p = (char *)0;
8770+ yyg->yy_init = 0;
8771+ yyg->yy_start = 0;
8772+
8773+ yyg->yy_start_stack_ptr = 0;
8774+ yyg->yy_start_stack_depth = 0;
8775+ yyg->yy_start_stack = NULL;
8776
8777 /* Defined in main.c */
8778 #ifdef YY_STDINIT
8779- yyin = stdin;
8780- yyout = stdout;
8781+ yyin = stdin;
8782+ yyout = stdout;
8783 #else
8784- yyin = (FILE *) 0;
8785- yyout = (FILE *) 0;
8786+ yyin = (FILE *)0;
8787+ yyout = (FILE *)0;
8788 #endif
8789
8790- /* For future reference: Set errno on error, since we are called by
8791- * tsconfiglex_init()
8792- */
8793- return 0;
8794+ /* For future reference: Set errno on error, since we are called by
8795+ * tsconfiglex_init()
8796+ */
8797+ return 0;
8798 }
8799
8800 /* tsconfiglex_destroy is for both reentrant and non-reentrant scanners. */
8801-int tsconfiglex_destroy (yyscan_t yyscanner)
8802+int
8803+tsconfiglex_destroy(yyscan_t yyscanner)
8804 {
8805- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8806-
8807- /* Pop the buffer stack, destroying each element. */
8808- while(YY_CURRENT_BUFFER){
8809- tsconfig_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
8810- YY_CURRENT_BUFFER_LVALUE = NULL;
8811- tsconfigpop_buffer_state(yyscanner);
8812- }
8813-
8814- /* Destroy the stack itself. */
8815- tsconfigfree(yyg->yy_buffer_stack ,yyscanner);
8816- yyg->yy_buffer_stack = NULL;
8817-
8818- /* Destroy the start condition stack. */
8819- tsconfigfree(yyg->yy_start_stack ,yyscanner );
8820- yyg->yy_start_stack = NULL;
8821-
8822- /* Reset the globals. This is important in a non-reentrant scanner so the next time
8823- * tsconfiglex() is called, initialization will occur. */
8824- yy_init_globals( yyscanner);
8825-
8826- /* Destroy the main struct (reentrant only). */
8827- tsconfigfree ( yyscanner , yyscanner );
8828- yyscanner = NULL;
8829- return 0;
8830+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8831+
8832+ /* Pop the buffer stack, destroying each element. */
8833+ while (YY_CURRENT_BUFFER) {
8834+ tsconfig_delete_buffer(YY_CURRENT_BUFFER, yyscanner);
8835+ YY_CURRENT_BUFFER_LVALUE = NULL;
8836+ tsconfigpop_buffer_state(yyscanner);
8837+ }
8838+
8839+ /* Destroy the stack itself. */
8840+ tsconfigfree(yyg->yy_buffer_stack, yyscanner);
8841+ yyg->yy_buffer_stack = NULL;
8842+
8843+ /* Destroy the start condition stack. */
8844+ tsconfigfree(yyg->yy_start_stack, yyscanner);
8845+ yyg->yy_start_stack = NULL;
8846+
8847+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
8848+ * tsconfiglex() is called, initialization will occur. */
8849+ yy_init_globals(yyscanner);
8850+
8851+ /* Destroy the main struct (reentrant only). */
8852+ tsconfigfree(yyscanner, yyscanner);
8853+ yyscanner = NULL;
8854+ return 0;
8855 }
8856
8857 /*
8858@@ -2080,76 +1993,85 @@ int tsconfiglex_destroy (yyscan_t yyscanner)
8859 */
8860
8861 #ifndef yytext_ptr
8862-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
8863+static void
8864+yy_flex_strncpy(char *s1, yyconst char *s2, int n, yyscan_t yyscanner)
8865 {
8866- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8867- (void)yyg;
8868+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8869+ (void)yyg;
8870
8871- int i;
8872- for ( i = 0; i < n; ++i )
8873- s1[i] = s2[i];
8874+ int i;
8875+ for (i = 0; i < n; ++i)
8876+ s1[i] = s2[i];
8877 }
8878 #endif
8879
8880 #ifdef YY_NEED_STRLEN
8881-static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
8882+static int
8883+yy_flex_strlen(yyconst char *s, yyscan_t yyscanner)
8884 {
8885- int n;
8886- for ( n = 0; s[n]; ++n )
8887- ;
8888+ int n;
8889+ for (n = 0; s[n]; ++n)
8890+ ;
8891
8892- return n;
8893+ return n;
8894 }
8895 #endif
8896
8897-void *tsconfigalloc (yy_size_t size , yyscan_t yyscanner)
8898+void *
8899+tsconfigalloc(yy_size_t size, yyscan_t yyscanner)
8900 {
8901- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8902- (void)yyg;
8903- return (void *) malloc( size );
8904+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8905+ (void)yyg;
8906+ return (void *)malloc(size);
8907 }
8908
8909-void *tsconfigrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
8910+void *
8911+tsconfigrealloc(void *ptr, yy_size_t size, yyscan_t yyscanner)
8912 {
8913- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8914- (void)yyg;
8915-
8916- /* The cast to (char *) in the following accommodates both
8917- * implementations that use char* generic pointers, and those
8918- * that use void* generic pointers. It works with the latter
8919- * because both ANSI C and C++ allow castless assignment from
8920- * any pointer type to void*, and deal with argument conversions
8921- * as though doing an assignment.
8922- */
8923- return (void *) realloc( (char *) ptr, size );
8924+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8925+ (void)yyg;
8926+
8927+ /* The cast to (char *) in the following accommodates both
8928+ * implementations that use char* generic pointers, and those
8929+ * that use void* generic pointers. It works with the latter
8930+ * because both ANSI C and C++ allow castless assignment from
8931+ * any pointer type to void*, and deal with argument conversions
8932+ * as though doing an assignment.
8933+ */
8934+ return (void *)realloc((char *)ptr, size);
8935 }
8936
8937-void tsconfigfree (void * ptr , yyscan_t yyscanner)
8938+void
8939+tsconfigfree(void *ptr, yyscan_t yyscanner)
8940 {
8941- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
8942- (void)yyg;
8943- free( (char *) ptr ); /* see tsconfigrealloc() for (char *) cast */
8944+ struct yyguts_t *yyg = (struct yyguts_t *)yyscanner;
8945+ (void)yyg;
8946+ free((char *)ptr); /* see tsconfigrealloc() for (char *) cast */
8947 }
8948
8949 #define YYTABLES_NAME "yytables"
8950
8951 #line 104 "TsConfigSyntax.l"
8952
8953-
8954-
8955-int tsconfiglex_current_line(void) { return TsConfig_Lex_Location._line; }
8956-int tsconfiglex_current_col(void) { return TsConfig_Lex_Location._col; }
8957+int
8958+tsconfiglex_current_line(void)
8959+{
8960+ return TsConfig_Lex_Location._line;
8961+}
8962+int
8963+tsconfiglex_current_col(void)
8964+{
8965+ return TsConfig_Lex_Location._col;
8966+}
8967
8968 // This is in here because it's easier than trying to convince automake
8969 // to let me have a generated header from flex. The header is only needed
8970 // to define the various macros used here outside of the .l file so if
8971 // this is here, we don't need the header anymore. This also means we
8972 // don't have to deal with C/C++ issues in that regard either.
8973-int tsconfig_parse_buffer(
8974- struct TsConfigHandlers* handlers,
8975- char* buffer,
8976- size_t buffer_len
8977-) {
8978+int
8979+tsconfig_parse_buffer(struct TsConfigHandlers *handlers, char *buffer, size_t buffer_len)
8980+{
8981 int zret;
8982 yyscan_t lexer;
8983 YY_BUFFER_STATE lexer_buffer_state;
8984@@ -2157,12 +2079,11 @@ int tsconfig_parse_buffer(
8985 tsconfiglex_init(&lexer);
8986 tsconfigset_extra(handlers, lexer);
8987 lexer_buffer_state = tsconfig_scan_buffer(buffer, buffer_len, lexer);
8988- zret = tsconfigparse(lexer, handlers);
8989+ zret = tsconfigparse(lexer, handlers);
8990 tsconfig_delete_buffer(lexer_buffer_state, lexer);
8991 tsconfiglex_destroy(lexer);
8992
8993 return zret;
8994 }
8995
8996-# endif // __clang_analyzer__
8997-
8998+#endif // __clang_analyzer__
8999diff --git a/lib/tsconfig/TsConfigTypes.h b/lib/tsconfig/TsConfigTypes.h
9000index 6c64e04e9..fef5ebae1 100644
9001--- a/lib/tsconfig/TsConfigTypes.h
9002+++ b/lib/tsconfig/TsConfigTypes.h
9003@@ -1,5 +1,5 @@
9004-# if ! defined(TS_CONFIG_TYPES_HEADER)
9005-# define TS_CONFIG_TYPES_HEADER
9006+#if !defined(TS_CONFIG_TYPES_HEADER)
9007+#define TS_CONFIG_TYPES_HEADER
9008
9009 /** @file
9010
9011@@ -24,43 +24,46 @@
9012 limitations under the License.
9013 */
9014
9015-# if defined(_MSC_VER)
9016-# include <stddef.h>
9017-# else
9018-# include <unistd.h>
9019-# endif
9020+#if defined(_MSC_VER)
9021+#include <stddef.h>
9022+#else
9023+#include <unistd.h>
9024+#endif
9025
9026-# if defined(__cplusplus)
9027-namespace ts { namespace config {
9028-# endif
9029+#if defined(__cplusplus)
9030+namespace ts
9031+{
9032+namespace config
9033+{
9034+#endif
9035
9036-/** A location in the source stream.
9037- @internal At some point we may need to add stream information,
9038- e.g. file name, once includes are supported. Or should that
9039- be the caller's responsibility?
9040- */
9041-struct Location {
9042- int _col; ///< Column.
9043- int _line; ///< Line.
9044-};
9045+ /** A location in the source stream.
9046+ @internal At some point we may need to add stream information,
9047+ e.g. file name, once includes are supported. Or should that
9048+ be the caller's responsibility?
9049+ */
9050+ struct Location {
9051+ int _col; ///< Column.
9052+ int _line; ///< Line.
9053+ };
9054
9055-/** A token from the source stream.
9056- @internal We should use ts::Buffer here, but because this
9057- has to work in C as well, it's less painful to do it by hand.
9058- */
9059-struct Token {
9060- char* _s; ///< Text of token.
9061- size_t _n; ///< Text length.
9062- int _type; ///< Type of token.
9063- struct Location _loc; ///< Location of token.
9064-};
9065+ /** A token from the source stream.
9066+ @internal We should use ts::Buffer here, but because this
9067+ has to work in C as well, it's less painful to do it by hand.
9068+ */
9069+ struct Token {
9070+ char *_s; ///< Text of token.
9071+ size_t _n; ///< Text length.
9072+ int _type; ///< Type of token.
9073+ struct Location _loc; ///< Location of token.
9074+ };
9075
9076-# if defined(__cplusplus)
9077-}} // namespace ts::config
9078-# define YYSTYPE ts::config::Token
9079-# else
9080-# define YYSTYPE struct Token
9081+#if defined(__cplusplus)
9082+}
9083+} // namespace ts::config
9084+#define YYSTYPE ts::config::Token
9085+#else
9086+#define YYSTYPE struct Token
9087 #endif
9088
9089-
9090-# endif // TS_CONFIG_TYPES_HEADER
9091+#endif // TS_CONFIG_TYPES_HEADER
9092diff --git a/lib/tsconfig/TsErrataUtil.cc b/lib/tsconfig/TsErrataUtil.cc
9093index 1f8fbed8e..e8e762a48 100644
9094--- a/lib/tsconfig/TsErrataUtil.cc
9095+++ b/lib/tsconfig/TsErrataUtil.cc
9096@@ -21,170 +21,177 @@
9097 limitations under the License.
9098 */
9099
9100-# if !defined(_MSC_VER)
9101-# include <cstdio>
9102-# include <cstring>
9103-# endif
9104-# include <cstdarg>
9105-# include <cerrno>
9106-# include <TsErrataUtil.h>
9107-# include "tscore/ink_string.h"
9108-# include "tscore/ink_defs.h"
9109-
9110-namespace ts { namespace msg {
9111-
9112-Errata::Code FATAL = 3; ///< Fatal, cannot continue.
9113-Errata::Code WARN = 2; ///< Significant, should be fixed.
9114-Errata::Code INFO = 1; /// Interesting, not necessarily a problem.
9115-Errata::Code DEBUG = 0; /// Debugging information.
9116-
9117-# if defined(_MSC_VER)
9118-char* strerror_r(int err, char* s, size_t n) {
9119+#if !defined(_MSC_VER)
9120+#include <cstdio>
9121+#include <cstring>
9122+#endif
9123+#include <cstdarg>
9124+#include <cerrno>
9125+#include <TsErrataUtil.h>
9126+#include "tscore/ink_string.h"
9127+#include "tscore/ink_defs.h"
9128+
9129+namespace ts
9130+{
9131+namespace msg
9132+{
9133+ Errata::Code FATAL = 3; ///< Fatal, cannot continue.
9134+ Errata::Code WARN = 2; ///< Significant, should be fixed.
9135+ Errata::Code INFO = 1; /// Interesting, not necessarily a problem.
9136+ Errata::Code DEBUG = 0; /// Debugging information.
9137+
9138+#if defined(_MSC_VER)
9139+ char *
9140+ strerror_r(int err, char *s, size_t n)
9141+ {
9142 ink_strlcpy(s, strerror(err), n);
9143 return s;
9144-}
9145+ }
9146
9147-# define snprintf _snprintf
9148-# endif
9149+#define snprintf _snprintf
9150+#endif
9151
9152-Errata&
9153-log(Errata& err, Errata::Id id, Errata::Code code, char const* text) {
9154- err.push(id, code, text);
9155- return err;
9156-}
9157+ Errata &
9158+ log(Errata &err, Errata::Id id, Errata::Code code, char const *text)
9159+ {
9160+ err.push(id, code, text);
9161+ return err;
9162+ }
9163
9164-Errata&
9165-log(Errata& err, Errata::Code code, char const* text) {
9166- err.push(0, code, text);
9167- return err;
9168-}
9169+ Errata &
9170+ log(Errata &err, Errata::Code code, char const *text)
9171+ {
9172+ err.push(0, code, text);
9173+ return err;
9174+ }
9175
9176-Errata&
9177-log(RvBase& rv, Errata::Code code, char const* text) {
9178+ Errata &
9179+ log(RvBase &rv, Errata::Code code, char const *text)
9180+ {
9181 rv._errata.push(0, code, text);
9182 return rv._errata;
9183-}
9184-
9185-Errata
9186-log(Errata::Code code, char const* text) {
9187- Errata err;
9188- err.push(0, code, text);
9189- return err;
9190-}
9191-
9192-Errata&
9193-vlogf(
9194- Errata& err,
9195- Errata::Id id,
9196- Errata::Code code,
9197- char const* format,
9198- va_list& rest
9199-) {
9200- static size_t const SIZE = 8192;
9201- char buffer[SIZE];
9202-
9203- vsnprintf(buffer, SIZE, format, rest);
9204- err.push(id, code, buffer);
9205- return err;
9206-}
9207-
9208-Errata&
9209-logf(
9210- Errata& err,
9211- Errata::Id id,
9212- Errata::Code code,
9213- char const* format,
9214- ...
9215-) {
9216- va_list rest;
9217- va_start(rest, format);
9218- vlogf(err, id, code, format, rest);
9219- va_end(rest);
9220- return err;
9221-}
9222-
9223-Errata
9224-logf(Errata::Code code, char const* format, ...) {
9225- Errata err;
9226- va_list rest;
9227- va_start(rest, format);
9228- vlogf(err, Errata::Id(0), code, format, rest);
9229- va_end(rest);
9230- return err;
9231-}
9232-
9233-Errata&
9234-logf(Errata& err, Errata::Code code, char const* format, ...) {
9235- va_list rest;
9236- va_start(rest, format);
9237- vlogf(err, Errata::Id(0), code, format, rest);
9238- va_end(rest);
9239- return err;
9240-}
9241-
9242-Errata&
9243-logf(RvBase& base, Errata::Code code, char const* format, ...) {
9244- va_list rest;
9245- va_start(rest, format);
9246- vlogf(base._errata, Errata::Id(0), code, format, rest);
9247- va_end(rest);
9248- return base._errata;
9249-}
9250-
9251-Errata
9252-log_errno(Errata::Code code, char const* text) {
9253- static size_t const SIZE = 1024;
9254- char buffer[SIZE];
9255- ATS_UNUSED_RETURN(strerror_r(errno, buffer, SIZE));
9256- return logf(code, "%s [%d] %s", text, errno, buffer);
9257-}
9258-
9259-Errata
9260-vlogf_errno(Errata& errata, Errata::Id id, Errata::Code code, char const* format, va_list& rest) {
9261- int e = errno; // Preserve value before making system calls.
9262- int n;
9263- static int const E_SIZE = 512;
9264- char e_buffer[E_SIZE];
9265- static int const T_SIZE = 8192;
9266- char t_buffer[T_SIZE];
9267-
9268- n = vsnprintf(t_buffer, T_SIZE, format, rest);
9269- if (0 <= n && n < T_SIZE) { // still have room.
9270- ATS_UNUSED_RETURN(strerror_r(e, e_buffer, E_SIZE));
9271- snprintf(t_buffer + n, T_SIZE - n, "[%d] %s", e, e_buffer);
9272 }
9273- errata.push(id, code, t_buffer);
9274- return errata;
9275-}
9276-
9277-Errata
9278-logf_errno(Errata::Code code, char const* format, ...) {
9279- Errata zret;
9280- va_list rest;
9281- va_start(rest, format);
9282- zret = vlogf_errno(zret, 0, code, format, rest);
9283- va_end(rest);
9284- return zret;
9285-}
9286-
9287-Errata
9288-logf_errno(Errata& errata, Errata::Code code, char const* format, ...) {
9289- Errata zret;
9290- va_list rest;
9291- va_start(rest, format);
9292- zret = vlogf_errno(errata, 0, code, format, rest);
9293- va_end(rest);
9294- return zret;
9295-}
9296-
9297-Errata
9298-logf_errno(RvBase& rv, Errata::Code code, char const* format, ...) {
9299- Errata zret;
9300- va_list rest;
9301- va_start(rest, format);
9302- zret = vlogf_errno(rv._errata, 0, code, format, rest);
9303- va_end(rest);
9304- return zret;
9305-}
9306-// ------------------------------------------------------
9307-}} // namespace ts::msg
9308+
9309+ Errata
9310+ log(Errata::Code code, char const *text)
9311+ {
9312+ Errata err;
9313+ err.push(0, code, text);
9314+ return err;
9315+ }
9316+
9317+ Errata &
9318+ vlogf(Errata &err, Errata::Id id, Errata::Code code, char const *format, va_list &rest)
9319+ {
9320+ static size_t const SIZE = 8192;
9321+ char buffer[SIZE];
9322+
9323+ vsnprintf(buffer, SIZE, format, rest);
9324+ err.push(id, code, buffer);
9325+ return err;
9326+ }
9327+
9328+ Errata &
9329+ logf(Errata &err, Errata::Id id, Errata::Code code, char const *format, ...)
9330+ {
9331+ va_list rest;
9332+ va_start(rest, format);
9333+ vlogf(err, id, code, format, rest);
9334+ va_end(rest);
9335+ return err;
9336+ }
9337+
9338+ Errata
9339+ logf(Errata::Code code, char const *format, ...)
9340+ {
9341+ Errata err;
9342+ va_list rest;
9343+ va_start(rest, format);
9344+ vlogf(err, Errata::Id(0), code, format, rest);
9345+ va_end(rest);
9346+ return err;
9347+ }
9348+
9349+ Errata &
9350+ logf(Errata &err, Errata::Code code, char const *format, ...)
9351+ {
9352+ va_list rest;
9353+ va_start(rest, format);
9354+ vlogf(err, Errata::Id(0), code, format, rest);
9355+ va_end(rest);
9356+ return err;
9357+ }
9358+
9359+ Errata &
9360+ logf(RvBase &base, Errata::Code code, char const *format, ...)
9361+ {
9362+ va_list rest;
9363+ va_start(rest, format);
9364+ vlogf(base._errata, Errata::Id(0), code, format, rest);
9365+ va_end(rest);
9366+ return base._errata;
9367+ }
9368+
9369+ Errata
9370+ log_errno(Errata::Code code, char const *text)
9371+ {
9372+ static size_t const SIZE = 1024;
9373+ char buffer[SIZE];
9374+ ATS_UNUSED_RETURN(strerror_r(errno, buffer, SIZE));
9375+ return logf(code, "%s [%d] %s", text, errno, buffer);
9376+ }
9377+
9378+ Errata
9379+ vlogf_errno(Errata &errata, Errata::Id id, Errata::Code code, char const *format, va_list &rest)
9380+ {
9381+ int e = errno; // Preserve value before making system calls.
9382+ int n;
9383+ static int const E_SIZE = 512;
9384+ char e_buffer[E_SIZE];
9385+ static int const T_SIZE = 8192;
9386+ char t_buffer[T_SIZE];
9387+
9388+ n = vsnprintf(t_buffer, T_SIZE, format, rest);
9389+ if (0 <= n && n < T_SIZE) { // still have room.
9390+ ATS_UNUSED_RETURN(strerror_r(e, e_buffer, E_SIZE));
9391+ snprintf(t_buffer + n, T_SIZE - n, "[%d] %s", e, e_buffer);
9392+ }
9393+ errata.push(id, code, t_buffer);
9394+ return errata;
9395+ }
9396+
9397+ Errata
9398+ logf_errno(Errata::Code code, char const *format, ...)
9399+ {
9400+ Errata zret;
9401+ va_list rest;
9402+ va_start(rest, format);
9403+ zret = vlogf_errno(zret, 0, code, format, rest);
9404+ va_end(rest);
9405+ return zret;
9406+ }
9407+
9408+ Errata
9409+ logf_errno(Errata &errata, Errata::Code code, char const *format, ...)
9410+ {
9411+ Errata zret;
9412+ va_list rest;
9413+ va_start(rest, format);
9414+ zret = vlogf_errno(errata, 0, code, format, rest);
9415+ va_end(rest);
9416+ return zret;
9417+ }
9418+
9419+ Errata
9420+ logf_errno(RvBase &rv, Errata::Code code, char const *format, ...)
9421+ {
9422+ Errata zret;
9423+ va_list rest;
9424+ va_start(rest, format);
9425+ zret = vlogf_errno(rv._errata, 0, code, format, rest);
9426+ va_end(rest);
9427+ return zret;
9428+ }
9429+ // ------------------------------------------------------
9430+} // namespace msg
9431+} // namespace ts
9432diff --git a/lib/tsconfig/TsErrataUtil.h b/lib/tsconfig/TsErrataUtil.h
9433index f9df89db1..6b6fd46c5 100644
9434--- a/lib/tsconfig/TsErrataUtil.h
9435+++ b/lib/tsconfig/TsErrataUtil.h
9436@@ -21,149 +21,135 @@
9437 limitations under the License.
9438 */
9439
9440-# if !defined(TS_ERRATA_UTIL_HEADER)
9441-# define TS_ERRATA_UTIL_HEADER
9442+#if !defined(TS_ERRATA_UTIL_HEADER)
9443+#define TS_ERRATA_UTIL_HEADER
9444
9445 // TBD: Need to do something better than this to get around using
9446 // 'DEBUG' as the name of a constant.
9447-# if defined DEBUG
9448-# undef DEBUG
9449-# define DEBUG DEBUG
9450-# endif
9451+#if defined DEBUG
9452+#undef DEBUG
9453+#define DEBUG DEBUG
9454+#endif
9455
9456-# include <Errata.h>
9457+#include <Errata.h>
9458
9459-namespace ts { namespace msg {
9460+namespace ts
9461+{
9462+namespace msg
9463+{
9464+ /// @name Message severity levels.
9465+ //@{
9466+ extern Errata::Code FATAL; ///< Fatal, cannot continue.
9467+ extern Errata::Code WARN; ///< Significant, function degraded.
9468+ extern Errata::Code INFO; ///< Interesting, not necessarily a problem.
9469+ extern Errata::Code DEBUG; ///< Debugging information.
9470+ //@}
9471
9472-/// @name Message severity levels.
9473-//@{
9474-extern Errata::Code FATAL; ///< Fatal, cannot continue.
9475-extern Errata::Code WARN; ///< Significant, function degraded.
9476-extern Errata::Code INFO; ///< Interesting, not necessarily a problem.
9477-extern Errata::Code DEBUG; ///< Debugging information.
9478-//@}
9479+ /** Logging / reporting support.
9480+ We build on top of @c Errata but we want to be able to prevent
9481+ message generation / allocation for messages with severity levels
9482+ less than a run time controllable value.
9483
9484-/** Logging / reporting support.
9485- We build on top of @c Errata but we want to be able to prevent
9486- message generation / allocation for messages with severity levels
9487- less than a run time controllable value.
9488+ @internal Far from complete but serving as a prototype / experiment
9489+ to learn what's actually useful.
9490+ */
9491+ //@{
9492+ /// Report literal string to an Errata.
9493+ /// @return @a err.
9494+ Errata &log(Errata &err, ///< Target errata.
9495+ Errata::Id id, ///< Message ID.
9496+ Errata::Code code, ///< Severity level.
9497+ char const *text ///< Message text.
9498+ );
9499+ /// Report literal string to an Errata.
9500+ /// Use message ID 0.
9501+ /// @return @a err.
9502+ Errata &log(Errata &err, ///< Target errata.
9503+ Errata::Code code, ///< Severity level.
9504+ char const *text ///< Message text.
9505+ );
9506+ /// Report literal string to a return value.
9507+ /// Use message ID 0.
9508+ /// @return The @c Errata in @a rv.
9509+ Errata &log(RvBase &rv, ///< Return value.
9510+ Errata::Code code, ///< Severity level.
9511+ char const *text ///< Message text.
9512+ );
9513+ /// printf style log to Errata.
9514+ /// @return @a err.
9515+ Errata &logf(Errata &err, ///< Target errata.
9516+ Errata::Id id, ///< Message ID.
9517+ Errata::Code code, ///< Severity level.
9518+ char const *format, ///< Format string.
9519+ ... ///< Format string parameters.
9520+ );
9521+ /// printf style log to Errata.
9522+ /// The message id is set to zero.
9523+ /// @return @a err.
9524+ Errata &logf(Errata &err, ///< Target errata.
9525+ Errata::Code code, ///< Severity level.
9526+ char const *format, ///< Format string.
9527+ ... ///< Format string parameters.
9528+ );
9529+ /// Return an Errata in a return value populated with a printf style formatted string.
9530+ /// Use message ID 0.
9531+ /// @return The @c Errata in @a rv.
9532+ Errata &logf(RvBase &rv, ///< Rv value.
9533+ Errata::Code code, ///< Severity level.
9534+ char const *format, ///< Message text.
9535+ ...);
9536+ /// Return an Errata populated with a literal string.
9537+ /// Use message ID 0.
9538+ /// @return @a err.
9539+ Errata log(Errata::Code code, ///< Severity level.
9540+ char const *text ///< Message text.
9541+ );
9542+ /// Return an Errata populated with a printf style formatted string.
9543+ /// Use message ID 0.
9544+ /// @return @a err.
9545+ Errata logf(Errata::Code code, ///< Severity level.
9546+ char const *format, ///< Message text.
9547+ ...);
9548+ /** Return an Errata based on @c errno.
9549+ The literal string is combined with the system text for the current
9550+ value of @c errno. This is modeled on @c perror. Message ID 0 is used.
9551+ @return The new @c Errata.
9552+ */
9553+ Errata log_errno(Errata::Code code, ///< Severity level.
9554+ char const *text ///< Message text.
9555+ );
9556+ /** Return an @c Errata based on @c errno.
9557+ @c errno and the corresponding system error string are appended to
9558+ the results from the @a format and following arguments.
9559+ @return The new @c Errata.
9560+ */
9561+ Errata logf_errno(Errata::Code code, ///< Severity code.
9562+ char const *format, ///< Format string.
9563+ ... ///< Arguments for @a format.
9564+ );
9565+ /** Add a message to an @a errata based on @c errno.
9566+ @c errno and the corresponding system error string are appended to
9567+ the results from the @a format and following arguments.
9568+ @return @a errata.
9569+ */
9570+ Errata logf_errno(Errata &errata, ///< Errata to use.
9571+ Errata::Code code, ///< Severity code.
9572+ char const *format, ///< Format string.
9573+ ... ///< Arguments for @a format.
9574+ );
9575+ /** Add a message to a return value based on @c errno.
9576+ @c errno and the corresponding system error string are appended to
9577+ the results from the @a format and following arguments.
9578+ @return The errata in @a rv.
9579+ */
9580+ Errata logf_errno(RvBase &rv, ///< Return value.
9581+ Errata::Code code, ///< Severity code.
9582+ char const *format, ///< Format string.
9583+ ... ///< Arguments for @a format.
9584+ );
9585+ //@}
9586
9587- @internal Far from complete but serving as a prototype / experiment
9588- to learn what's actually useful.
9589-*/
9590-//@{
9591-/// Report literal string to an Errata.
9592-/// @return @a err.
9593-Errata& log(
9594- Errata& err,///< Target errata.
9595- Errata::Id id, ///< Message ID.
9596- Errata::Code code, ///< Severity level.
9597- char const* text ///< Message text.
9598-);
9599-/// Report literal string to an Errata.
9600-/// Use message ID 0.
9601-/// @return @a err.
9602-Errata& log(
9603- Errata& err,///< Target errata.
9604- Errata::Code code, ///< Severity level.
9605- char const* text ///< Message text.
9606-);
9607-/// Report literal string to a return value.
9608-/// Use message ID 0.
9609-/// @return The @c Errata in @a rv.
9610-Errata& log(
9611- RvBase& rv,///< Return value.
9612- Errata::Code code, ///< Severity level.
9613- char const* text ///< Message text.
9614-);
9615-/// printf style log to Errata.
9616-/// @return @a err.
9617-Errata& logf(
9618- Errata& err,///< Target errata.
9619- Errata::Id id, ///< Message ID.
9620- Errata::Code code, ///< Severity level.
9621- char const* format, ///< Format string.
9622- ... ///< Format string parameters.
9623-);
9624-/// printf style log to Errata.
9625-/// The message id is set to zero.
9626-/// @return @a err.
9627-Errata& logf(
9628- Errata& err,///< Target errata.
9629- Errata::Code code, ///< Severity level.
9630- char const* format, ///< Format string.
9631- ... ///< Format string parameters.
9632-);
9633-/// Return an Errata in a return value populated with a printf style formatted string.
9634-/// Use message ID 0.
9635-/// @return The @c Errata in @a rv.
9636-Errata& logf(
9637- RvBase& rv, ///< Rv value.
9638- Errata::Code code, ///< Severity level.
9639- char const* format, ///< Message text.
9640- ...
9641-);
9642-/// Return an Errata populated with a literal string.
9643-/// Use message ID 0.
9644-/// @return @a err.
9645-Errata log(
9646- Errata::Code code, ///< Severity level.
9647- char const* text ///< Message text.
9648-);
9649-/// Return an Errata populated with a printf style formatted string.
9650-/// Use message ID 0.
9651-/// @return @a err.
9652-Errata logf(
9653- Errata::Code code, ///< Severity level.
9654- char const* format, ///< Message text.
9655- ...
9656-);
9657-/** Return an Errata based on @c errno.
9658- The literal string is combined with the system text for the current
9659- value of @c errno. This is modeled on @c perror. Message ID 0 is used.
9660- @return The new @c Errata.
9661- */
9662-Errata log_errno(
9663- Errata::Code code, ///< Severity level.
9664- char const* text ///< Message text.
9665-);
9666-/** Return an @c Errata based on @c errno.
9667- @c errno and the corresponding system error string are appended to
9668- the results from the @a format and following arguments.
9669- @return The new @c Errata.
9670- */
9671-Errata
9672-logf_errno(
9673- Errata::Code code, ///< Severity code.
9674- char const* format, ///< Format string.
9675- ... ///< Arguments for @a format.
9676-);
9677-/** Add a message to an @a errata based on @c errno.
9678- @c errno and the corresponding system error string are appended to
9679- the results from the @a format and following arguments.
9680- @return @a errata.
9681- */
9682-Errata
9683-logf_errno(
9684- Errata& errata, ///< Errata to use.
9685- Errata::Code code, ///< Severity code.
9686- char const* format, ///< Format string.
9687- ... ///< Arguments for @a format.
9688-);
9689-/** Add a message to a return value based on @c errno.
9690- @c errno and the corresponding system error string are appended to
9691- the results from the @a format and following arguments.
9692- @return The errata in @a rv.
9693- */
9694-Errata
9695-logf_errno(
9696- RvBase& rv, ///< Return value.
9697- Errata::Code code, ///< Severity code.
9698- char const* format, ///< Format string.
9699- ... ///< Arguments for @a format.
9700-);
9701-//@}
9702-
9703-}} // namespace ts::msg
9704+} // namespace msg
9705+} // namespace ts
9706
9707-# endif // define TS_ERRATA_UTIL_HEADER
9708+#endif // define TS_ERRATA_UTIL_HEADER
9709diff --git a/lib/tsconfig/TsValue.cc b/lib/tsconfig/TsValue.cc
9710index 0cccc5655..dba70ec4b 100644
9711--- a/lib/tsconfig/TsValue.cc
9712+++ b/lib/tsconfig/TsValue.cc
9713@@ -21,372 +21,443 @@
9714 limitations under the License.
9715 */
9716
9717-# include "TsValue.h"
9718-# include "TsBuilder.h"
9719-# include "tscore/ink_defs.h"
9720+#include "TsValue.h"
9721+#include "TsBuilder.h"
9722+#include "tscore/ink_defs.h"
9723
9724-# include <TsErrataUtil.h>
9725-# include <sys/stat.h>
9726-# include <cstdio>
9727-# include <cstdlib>
9728+#include <TsErrataUtil.h>
9729+#include <sys/stat.h>
9730+#include <cstdio>
9731+#include <cstdlib>
9732
9733-# if !defined(_MSC_VER)
9734-# define _fileno fileno
9735-# endif
9736+#if !defined(_MSC_VER)
9737+#define _fileno fileno
9738+#endif
9739
9740 // ---------------------------------------------------------------------------
9741-namespace ts { namespace config {
9742-// ---------------------------------------------------------------------------
9743-Buffer const detail::NULL_BUFFER;
9744-ConstBuffer const detail::NULL_CONST_BUFFER;
9745-detail::ValueItem detail::ValueTableImpl::NULL_ITEM(VoidValue);
9746-detail::PseudoBool::Type const detail::PseudoBool::FALSE = nullptr;
9747-detail::PseudoBool::Type const detail::PseudoBool::TRUE = &detail::PseudoBool::operator !;
9748-// This should not be called, it is used only as a pointer value.
9749-bool detail::PseudoBool::operator ! () const { return false; }
9750-// ---------------------------------------------------------------------------
9751-unsigned int const detail::Type_Property[N_VALUE_TYPES] = {
9752- 0, // Void
9753- detail::IS_VALID | detail::IS_CONTAINER, // List
9754- detail::IS_VALID | detail::IS_CONTAINER, // Group
9755- detail::IS_VALID | detail::IS_LITERAL, // String
9756- detail::IS_VALID | detail::IS_LITERAL, // Integer
9757-};
9758-// ---------------------------------------------------------------------------
9759-detail::ValueTableImpl::ValueTableImpl() : _generation(0) { }
9760-detail::ValueTableImpl::~ValueTableImpl() {
9761- for (auto & _buffer : _buffers) {
9762- free(_buffer._ptr);
9763-}
9764-}
9765-// ---------------------------------------------------------------------------
9766-detail::ValueTable::ImplType*
9767-detail::ValueTable::instance() {
9768- // Stupid workaround for clang analyzer false positive. The new instance isn't leaked because
9769- // it's stored in a shared ptr type.
9770+namespace ts
9771+{
9772+namespace config
9773+{
9774+ // ---------------------------------------------------------------------------
9775+ Buffer const detail::NULL_BUFFER;
9776+ ConstBuffer const detail::NULL_CONST_BUFFER;
9777+ detail::ValueItem detail::ValueTableImpl::NULL_ITEM(VoidValue);
9778+ detail::PseudoBool::Type const detail::PseudoBool::FALSE = nullptr;
9779+ detail::PseudoBool::Type const detail::PseudoBool::TRUE = &detail::PseudoBool::operator!;
9780+ // This should not be called, it is used only as a pointer value.
9781+ bool detail::PseudoBool::operator!() const { return false; }
9782+ // ---------------------------------------------------------------------------
9783+ unsigned int const detail::Type_Property[N_VALUE_TYPES] = {
9784+ 0, // Void
9785+ detail::IS_VALID | detail::IS_CONTAINER, // List
9786+ detail::IS_VALID | detail::IS_CONTAINER, // Group
9787+ detail::IS_VALID | detail::IS_LITERAL, // String
9788+ detail::IS_VALID | detail::IS_LITERAL, // Integer
9789+ };
9790+ // ---------------------------------------------------------------------------
9791+ detail::ValueTableImpl::ValueTableImpl() : _generation(0) {}
9792+ detail::ValueTableImpl::~ValueTableImpl()
9793+ {
9794+ for (auto &_buffer : _buffers) {
9795+ free(_buffer._ptr);
9796+ }
9797+ }
9798+ // ---------------------------------------------------------------------------
9799+ detail::ValueTable::ImplType *
9800+ detail::ValueTable::instance()
9801+ {
9802+ // Stupid workaround for clang analyzer false positive. The new instance isn't leaked because
9803+ // it's stored in a shared ptr type.
9804 #if !defined(__clang_analyzer__)
9805- if (! _ptr) { _ptr.reset(new ImplType); }
9806+ if (!_ptr) {
9807+ _ptr.reset(new ImplType);
9808+ }
9809 #else
9810- assert(_ptr.get() != nullptr);
9811+ assert(_ptr.get() != nullptr);
9812 #endif
9813- return _ptr.get();
9814-}
9815+ return _ptr.get();
9816+ }
9817
9818-detail::ValueTable&
9819-detail::ValueTable::forceRootItem() {
9820- ImplType* imp = this->instance();
9821- if (0 == imp->_values.size()) {
9822- imp->_values.push_back(ValueItem(GroupValue));
9823-}
9824- return *this;
9825-}
9826+ detail::ValueTable &
9827+ detail::ValueTable::forceRootItem()
9828+ {
9829+ ImplType *imp = this->instance();
9830+ if (0 == imp->_values.size()) {
9831+ imp->_values.push_back(ValueItem(GroupValue));
9832+ }
9833+ return *this;
9834+ }
9835
9836-Rv<detail::ValueIndex>
9837-detail::ValueTable::make(ValueIndex pidx, ValueType type, ConstBuffer const& name) {
9838- Rv<ValueIndex> zret = NULL_VALUE_INDEX;
9839- if (_ptr) {
9840- size_t n = _ptr->_values.size();
9841- // Check the parent
9842- if (pidx < n) {
9843- ValueItem* parent = &(_ptr->_values[pidx]);
9844- if (IS_CONTAINER & Type_Property[parent->_type]) {
9845- ValueItem* item;
9846+ Rv<detail::ValueIndex>
9847+ detail::ValueTable::make(ValueIndex pidx, ValueType type, ConstBuffer const &name)
9848+ {
9849+ Rv<ValueIndex> zret = NULL_VALUE_INDEX;
9850+ if (_ptr) {
9851+ size_t n = _ptr->_values.size();
9852+ // Check the parent
9853+ if (pidx < n) {
9854+ ValueItem *parent = &(_ptr->_values[pidx]);
9855+ if (IS_CONTAINER & Type_Property[parent->_type]) {
9856+ ValueItem *item;
9857
9858- _ptr->_values.push_back(ValueItem(type));
9859- parent = &(_ptr->_values[pidx]); // possibly stale, refresh.
9860- item = &(_ptr->_values[n]);
9861- item->_parent = pidx;
9862- parent->_children.push_back(n);
9863- item->_local_index = parent->_children.size() - 1;
9864- // Only use the name if the parent is a group.
9865- if (GroupValue == parent->_type) { item->_name = name;
9866-}
9867- zret = n; // mark for return to caller.
9868+ _ptr->_values.push_back(ValueItem(type));
9869+ parent = &(_ptr->_values[pidx]); // possibly stale, refresh.
9870+ item = &(_ptr->_values[n]);
9871+ item->_parent = pidx;
9872+ parent->_children.push_back(n);
9873+ item->_local_index = parent->_children.size() - 1;
9874+ // Only use the name if the parent is a group.
9875+ if (GroupValue == parent->_type) {
9876+ item->_name = name;
9877+ }
9878+ zret = n; // mark for return to caller.
9879+ } else {
9880+ msg::log(zret.errata(), msg::WARN, "Add child failed because parent is not a container.");
9881+ }
9882 } else {
9883- msg::log(zret.errata(), msg::WARN, "Add child failed because parent is not a container.");
9884+ msg::logf(zret.errata(), msg::WARN, "Add child failed because parent index (%ul) is out of range (%ul).", pidx.raw(), n);
9885 }
9886 } else {
9887- msg::logf(zret.errata(), msg::WARN, "Add child failed because parent index (%ul) is out of range (%ul).", pidx.raw(), n);
9888+ msg::log(zret.errata(), msg::WARN, "Add child failed because the configuration is null.");
9889 }
9890- } else {
9891- msg::log(zret.errata(), msg::WARN, "Add child failed because the configuration is null.");
9892+ return zret;
9893 }
9894- return zret;
9895-}
9896
9897-detail::ValueItem&
9898-detail::ValueTable::operator [] ( ValueIndex idx ) {
9899- assert(_ptr && idx < _ptr->_values.size());
9900- return _ptr->_values[idx];
9901-}
9902-Buffer
9903-detail::ValueTable::alloc(size_t n) {
9904- ImplType* imp = this->instance();
9905- Buffer zret(static_cast<char*>(malloc(n)), n);
9906- if (zret._ptr) { imp->_buffers.push_back(zret);
9907-}
9908- return zret;
9909-}
9910+ detail::ValueItem &detail::ValueTable::operator[](ValueIndex idx)
9911+ {
9912+ assert(_ptr && idx < _ptr->_values.size());
9913+ return _ptr->_values[idx];
9914+ }
9915+ Buffer
9916+ detail::ValueTable::alloc(size_t n)
9917+ {
9918+ ImplType *imp = this->instance();
9919+ Buffer zret(static_cast<char *>(malloc(n)), n);
9920+ if (zret._ptr) {
9921+ imp->_buffers.push_back(zret);
9922+ }
9923+ return zret;
9924+ }
9925
9926-// ---------------------------------------------------------------------------
9927-Value
9928-Value::operator [] (size_t idx) const {
9929- Value zret;
9930- detail::ValueItem const* item = this->item();
9931- if (item && idx < item->_children.size()) {
9932- zret = Value(_config, item->_children[idx]);
9933- if (PathValue == zret.getType()) { zret = _config.getRoot().find(_config._table[zret._vidx]._path);
9934-}
9935+ // ---------------------------------------------------------------------------
9936+ Value Value::operator[](size_t idx) const
9937+ {
9938+ Value zret;
9939+ detail::ValueItem const *item = this->item();
9940+ if (item && idx < item->_children.size()) {
9941+ zret = Value(_config, item->_children[idx]);
9942+ if (PathValue == zret.getType()) {
9943+ zret = _config.getRoot().find(_config._table[zret._vidx]._path);
9944+ }
9945+ }
9946+ return zret;
9947 }
9948- return zret;
9949-}
9950
9951-Value
9952-Value::operator [] (ConstBuffer const& name) const {
9953- Value zret;
9954- detail::ValueItem const* item = this->item();
9955- if (item) {
9956- for (const auto & spot : item->_children) {
9957- if (_config._table[spot]._name == name) {
9958- zret = Value(_config, spot);
9959- if (PathValue == zret.getType()) { zret = _config.getRoot().find(_config._table[zret._vidx]._path);
9960-}
9961- break;
9962+ Value Value::operator[](ConstBuffer const &name) const
9963+ {
9964+ Value zret;
9965+ detail::ValueItem const *item = this->item();
9966+ if (item) {
9967+ for (const auto &spot : item->_children) {
9968+ if (_config._table[spot]._name == name) {
9969+ zret = Value(_config, spot);
9970+ if (PathValue == zret.getType()) {
9971+ zret = _config.getRoot().find(_config._table[zret._vidx]._path);
9972+ }
9973+ break;
9974+ }
9975 }
9976 }
9977+ return zret;
9978 }
9979- return zret;
9980-}
9981
9982-Value
9983-Value::find( ConstBuffer const& path ) {
9984- Value zret = *this;
9985- Path::Parser parser(path);
9986- Rv<Path::Parser::Result> x;
9987- ConstBuffer elt;
9988- for ( x = parser.parse(&elt) ; zret && Path::Parser::EOP != x && Path::Parser::ERROR != x ; x = parser.parse(&elt) ) {
9989- if (Path::Parser::TAG == x) { zret = zret[elt];
9990- } else if (Path::Parser::INDEX == x) { zret = zret[elt._size];
9991- } else { zret.reset();
9992-}
9993+ Value
9994+ Value::find(ConstBuffer const &path)
9995+ {
9996+ Value zret = *this;
9997+ Path::Parser parser(path);
9998+ Rv<Path::Parser::Result> x;
9999+ ConstBuffer elt;
10000+ for (x = parser.parse(&elt); zret && Path::Parser::EOP != x && Path::Parser::ERROR != x; x = parser.parse(&elt)) {
10001+ if (Path::Parser::TAG == x) {
10002+ zret = zret[elt];
10003+ } else if (Path::Parser::INDEX == x) {
10004+ zret = zret[elt._size];
10005+ } else {
10006+ zret.reset();
10007+ }
10008+ }
10009+ if (Path::Parser::EOP != x) {
10010+ zret.reset();
10011+ }
10012+ return zret;
10013 }
10014- if (Path::Parser::EOP != x) { zret.reset();
10015-}
10016- return zret;
10017-}
10018
10019-Value
10020-Value::find(Path const& path ) {
10021- Value zret = *this;
10022- for ( size_t i = 0, n = path.count() ; i < n && zret ; ++i ) {
10023- ConstBuffer const& elt = path[i];
10024- if (elt._ptr) { zret = zret[elt];
10025- } else { zret = zret[elt._size];
10026-}
10027+ Value
10028+ Value::find(Path const &path)
10029+ {
10030+ Value zret = *this;
10031+ for (size_t i = 0, n = path.count(); i < n && zret; ++i) {
10032+ ConstBuffer const &elt = path[i];
10033+ if (elt._ptr) {
10034+ zret = zret[elt];
10035+ } else {
10036+ zret = zret[elt._size];
10037+ }
10038+ }
10039+ return zret;
10040 }
10041- return zret;
10042-}
10043
10044-Rv<Value>
10045-Value::makeChild(ValueType type, ConstBuffer const& name) {
10046- Rv<Value> zret;
10047- Rv<detail::ValueIndex> vr = _config._table.make(this->_vidx, type, name);
10048- if (vr.isOK()) { zret = Value(_config, vr.result());
10049- } else { zret.errata() = vr.errata();
10050-}
10051- return zret;
10052-}
10053+ Rv<Value>
10054+ Value::makeChild(ValueType type, ConstBuffer const &name)
10055+ {
10056+ Rv<Value> zret;
10057+ Rv<detail::ValueIndex> vr = _config._table.make(this->_vidx, type, name);
10058+ if (vr.isOK()) {
10059+ zret = Value(_config, vr.result());
10060+ } else {
10061+ zret.errata() = vr.errata();
10062+ }
10063+ return zret;
10064+ }
10065
10066-Rv<Value>
10067-Value::makeGroup(ConstBuffer const& name) {
10068- return this->makeChild(GroupValue, name);
10069-}
10070+ Rv<Value>
10071+ Value::makeGroup(ConstBuffer const &name)
10072+ {
10073+ return this->makeChild(GroupValue, name);
10074+ }
10075
10076-Rv<Value>
10077-Value::makeList(ConstBuffer const& name) {
10078- return this->makeChild(ListValue, name);
10079-}
10080+ Rv<Value>
10081+ Value::makeList(ConstBuffer const &name)
10082+ {
10083+ return this->makeChild(ListValue, name);
10084+ }
10085
10086-Rv<Value>
10087-Value::makeString(ConstBuffer const& text, ConstBuffer const& name) {
10088- Rv<Value> zret = this->makeChild(StringValue, name);
10089- if (zret.isOK()) { zret.result().setText(text);
10090-}
10091- return zret;
10092-}
10093+ Rv<Value>
10094+ Value::makeString(ConstBuffer const &text, ConstBuffer const &name)
10095+ {
10096+ Rv<Value> zret = this->makeChild(StringValue, name);
10097+ if (zret.isOK()) {
10098+ zret.result().setText(text);
10099+ }
10100+ return zret;
10101+ }
10102
10103-Rv<Value>
10104-Value::makeInteger(ConstBuffer const& text, ConstBuffer const& name) {
10105- Rv<Value> zret = this->makeChild(IntegerValue, name);
10106- if (zret.isOK()) { zret.result().setText(text);
10107-}
10108- return zret;
10109-}
10110+ Rv<Value>
10111+ Value::makeInteger(ConstBuffer const &text, ConstBuffer const &name)
10112+ {
10113+ Rv<Value> zret = this->makeChild(IntegerValue, name);
10114+ if (zret.isOK()) {
10115+ zret.result().setText(text);
10116+ }
10117+ return zret;
10118+ }
10119
10120-Rv<Value>
10121-Value::makePath(Path const& path, ConstBuffer const& name) {
10122- Rv<Value> zret = this->makeChild(PathValue, name);
10123- if (zret.isOK()) { _config._table[zret.result()._vidx]._path = path;
10124-}
10125- return zret;
10126-}
10127-// ---------------------------------------------------------------------------
10128-Path& Path::reset() {
10129- if (_ptr) {
10130- // If we're sharing the instance, make a new one for us.
10131- if (_ptr.use_count() > 1) {
10132- _ptr.reset(new ImplType);
10133- } else { // clear out the existing instance.
10134- _ptr->_elements.clear();
10135+ Rv<Value>
10136+ Value::makePath(Path const &path, ConstBuffer const &name)
10137+ {
10138+ Rv<Value> zret = this->makeChild(PathValue, name);
10139+ if (zret.isOK()) {
10140+ _config._table[zret.result()._vidx]._path = path;
10141 }
10142+ return zret;
10143 }
10144- return *this;
10145-}
10146-// ---------------------------------------------------------------------------
10147-Rv<Path::Parser::Result>
10148-Path::Parser::parse(ConstBuffer *cbuff) {
10149- Rv<Result> zret = EOP;
10150- enum State {
10151- S_INIT, // initial state
10152- S_INDEX, // reading index.
10153- S_TAG, // reading tag.
10154- S_DASH, // reading dashes in tag.
10155- } state = S_INIT;
10156+ // ---------------------------------------------------------------------------
10157+ Path &
10158+ Path::reset()
10159+ {
10160+ if (_ptr) {
10161+ // If we're sharing the instance, make a new one for us.
10162+ if (_ptr.use_count() > 1) {
10163+ _ptr.reset(new ImplType);
10164+ } else { // clear out the existing instance.
10165+ _ptr->_elements.clear();
10166+ }
10167+ }
10168+ return *this;
10169+ }
10170+ // ---------------------------------------------------------------------------
10171+ Rv<Path::Parser::Result>
10172+ Path::Parser::parse(ConstBuffer *cbuff)
10173+ {
10174+ Rv<Result> zret = EOP;
10175+ enum State {
10176+ S_INIT, // initial state
10177+ S_INDEX, // reading index.
10178+ S_TAG, // reading tag.
10179+ S_DASH, // reading dashes in tag.
10180+ } state = S_INIT;
10181
10182- // Character bucket
10183- enum Bucket {
10184- C_INVALID, // Invalid input.
10185- C_DIGIT, // digit.
10186- C_IDENT, // Identifier character.
10187- C_DASH, // A dash
10188- C_DOT, // A dot (period).
10189- };
10190+ // Character bucket
10191+ enum Bucket {
10192+ C_INVALID, // Invalid input.
10193+ C_DIGIT, // digit.
10194+ C_IDENT, // Identifier character.
10195+ C_DASH, // A dash
10196+ C_DOT, // A dot (period).
10197+ };
10198
10199- if (cbuff) { cbuff->reset();
10200-}
10201- char const* start = _c; // save starting character location.
10202- size_t idx = 0; // accumulator for index value.
10203+ if (cbuff) {
10204+ cbuff->reset();
10205+ }
10206+ char const *start = _c; // save starting character location.
10207+ size_t idx = 0; // accumulator for index value.
10208
10209- bool final = false;
10210- while (! final && this->hasInput()) {
10211- Bucket cb;
10212- if (isdigit(*_c)) { cb = C_DIGIT;
10213- } else if ('_' == *_c || isalpha(*_c)) { cb = C_IDENT;
10214- } else if ('-' == *_c) { cb = C_DASH;
10215- } else if ('.' == *_c) { cb = C_DOT;
10216- } else { cb = C_INVALID;
10217-}
10218+ bool final = false;
10219+ while (!final && this->hasInput()) {
10220+ Bucket cb;
10221+ if (isdigit(*_c)) {
10222+ cb = C_DIGIT;
10223+ } else if ('_' == *_c || isalpha(*_c)) {
10224+ cb = C_IDENT;
10225+ } else if ('-' == *_c) {
10226+ cb = C_DASH;
10227+ } else if ('.' == *_c) {
10228+ cb = C_DOT;
10229+ } else {
10230+ cb = C_INVALID;
10231+ }
10232
10233- if (C_INVALID == cb) {
10234- msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in path.", *_c, *_c);
10235- } else { switch (state) {
10236- case S_INIT:
10237- switch (cb) {
10238- case C_DIGIT: state = S_INDEX; idx = *_c - '0'; break;
10239- case C_IDENT: state = S_TAG; break;
10240- case C_DASH: msg::logf(zret, msg::WARN, "Dash not allowed as leading character for tag."); final = true; break;
10241- case C_DOT: msg::logf(zret, msg::WARN, "Separator without preceding element."); final = true; break;
10242- default: msg::logf(zret, msg::WARN, "Internal error: unexpected character %u in INIT state.", *_c); final = true; break;
10243- }
10244- break;
10245- case S_INDEX: // reading an index.
10246- if (C_DIGIT == cb) { idx = 10 * idx + *_c - '0';
10247- } else if (C_DOT == cb) { final = true; }
10248- else {
10249- msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in index element.", *_c, *_c);
10250- final = true;
10251- }
10252- break;
10253- case S_TAG: // reading a tag.
10254- if (C_IDENT == cb || C_DIGIT == cb) { ; // continue
10255- } else if (C_DASH == cb) { state = S_DASH;
10256- } else if (C_DOT == cb) { final = true; }
10257- else { // should never happen, but be safe.
10258- msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in index element.", *_c, *_c);
10259- final = true;
10260+ if (C_INVALID == cb) {
10261+ msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in path.", *_c, *_c);
10262+ } else {
10263+ switch (state) {
10264+ case S_INIT:
10265+ switch (cb) {
10266+ case C_DIGIT:
10267+ state = S_INDEX;
10268+ idx = *_c - '0';
10269+ break;
10270+ case C_IDENT:
10271+ state = S_TAG;
10272+ break;
10273+ case C_DASH:
10274+ msg::logf(zret, msg::WARN, "Dash not allowed as leading character for tag.");
10275+ final = true;
10276+ break;
10277+ case C_DOT:
10278+ msg::logf(zret, msg::WARN, "Separator without preceding element.");
10279+ final = true;
10280+ break;
10281+ default:
10282+ msg::logf(zret, msg::WARN, "Internal error: unexpected character %u in INIT state.", *_c);
10283+ final = true;
10284+ break;
10285+ }
10286+ break;
10287+ case S_INDEX: // reading an index.
10288+ if (C_DIGIT == cb) {
10289+ idx = 10 * idx + *_c - '0';
10290+ } else if (C_DOT == cb) {
10291+ final = true;
10292+ } else {
10293+ msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in index element.", *_c, *_c);
10294+ final = true;
10295+ }
10296+ break;
10297+ case S_TAG: // reading a tag.
10298+ if (C_IDENT == cb || C_DIGIT == cb) {
10299+ ; // continue
10300+ } else if (C_DASH == cb) {
10301+ state = S_DASH;
10302+ } else if (C_DOT == cb) {
10303+ final = true;
10304+ } else { // should never happen, but be safe.
10305+ msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in index element.", *_c, *_c);
10306+ final = true;
10307+ }
10308+ break;
10309+ case S_DASH: // dashes inside tag.
10310+ if (C_IDENT == cb || C_DIGIT == cb) {
10311+ state = S_TAG;
10312+ } else if (C_DOT == cb) {
10313+ msg::log(zret, msg::WARN, "Trailing dash not allowed in tag element.");
10314+ final = true;
10315+ } else if (C_DASH != cb) { // should never happen, but be safe.
10316+ msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in index element.", *_c, *_c);
10317+ final = true;
10318+ }
10319+ break;
10320 }
10321- break;
10322- case S_DASH: // dashes inside tag.
10323- if (C_IDENT == cb || C_DIGIT == cb) { state = S_TAG;
10324- } else if (C_DOT == cb) {
10325- msg::log(zret, msg::WARN, "Trailing dash not allowed in tag element.");
10326- final = true;
10327- } else if (C_DASH != cb) { // should never happen, but be safe.
10328- msg::logf(zret, msg::WARN, "Invalid character '%c' [%u] in index element.", *_c, *_c);
10329- final = true;
10330+ }
10331+ ++_c;
10332+ }
10333+ if (!zret.isOK()) {
10334+ zret = ERROR;
10335+ if (cbuff) {
10336+ cbuff->set(_c - 1, 1);
10337+ }
10338+ _c = nullptr;
10339+ _input.reset();
10340+ } else if (S_INIT == state) {
10341+ zret = EOP;
10342+ } else if (S_TAG == state) {
10343+ zret = TAG;
10344+ if (cbuff) {
10345+ cbuff->set(start, _c - start);
10346+ // if @a final is set, then we parsed a dot separator.
10347+ // don't include it in the returned tag.
10348+ if (final) {
10349+ cbuff->_size -= 1;
10350 }
10351- break;
10352 }
10353-}
10354- ++_c;
10355- }
10356- if (!zret.isOK()) {
10357- zret = ERROR;
10358- if (cbuff) { cbuff->set(_c - 1, 1);
10359-}
10360- _c = nullptr;
10361- _input.reset();
10362- } else if (S_INIT == state) {
10363- zret = EOP;
10364- } else if (S_TAG == state) {
10365- zret = TAG;
10366- if (cbuff) {
10367- cbuff->set(start, _c - start);
10368- // if @a final is set, then we parsed a dot separator.
10369- // don't include it in the returned tag.
10370- if (final) { cbuff->_size -= 1;
10371-}
10372+ } else if (S_INDEX == state) {
10373+ zret = INDEX;
10374+ if (cbuff) {
10375+ cbuff->_size = idx;
10376+ }
10377+ } else if (S_DASH == state) {
10378+ zret = ERROR;
10379+ msg::log(zret, msg::WARN, "Trailing dash not allowed in tag element.");
10380+ if (cbuff) {
10381+ cbuff->set(start, _c - start);
10382+ }
10383 }
10384- } else if (S_INDEX == state) {
10385- zret = INDEX;
10386- if (cbuff) { cbuff->_size = idx;
10387-}
10388- } else if (S_DASH == state) {
10389- zret = ERROR;
10390- msg::log(zret, msg::WARN, "Trailing dash not allowed in tag element.");
10391- if (cbuff) { cbuff->set(start, _c - start);
10392-}
10393+ return zret;
10394+ }
10395+ // ---------------------------------------------------------------------------
10396+ Value
10397+ Configuration::getRoot() const
10398+ {
10399+ const_cast<self *>(this)->_table.forceRootItem();
10400+ return Value(*this, 0);
10401 }
10402- return zret;
10403-}
10404-// ---------------------------------------------------------------------------
10405-Value
10406-Configuration::getRoot() const {
10407- const_cast<self*>(this)->_table.forceRootItem();
10408- return Value(*this, 0);
10409-}
10410
10411-Rv<Configuration>
10412-Configuration::loadFromPath(char const* path) {
10413- Rv<Configuration> zret;
10414- Buffer buffer;
10415- FILE* in = fopen(path, "r");
10416+ Rv<Configuration>
10417+ Configuration::loadFromPath(char const *path)
10418+ {
10419+ Rv<Configuration> zret;
10420+ Buffer buffer;
10421+ FILE *in = fopen(path, "r");
10422
10423- if (in) {
10424- struct stat info;
10425- if (0 == fstat(_fileno(in), &info)) {
10426- // Must reserve 2 bytes at the end for FLEX terminator.
10427- buffer = zret.result().alloc(info.st_size + 2);
10428- if (buffer._ptr) {
10429- size_t n;
10430- if (0 < (n = fread(buffer._ptr, sizeof(char), info.st_size, in))) {
10431- buffer._size = n+2;
10432- memset(buffer._ptr + n, 0, 2); // required by FLEX
10433- zret = Builder(zret.result()).build(buffer);
10434+ if (in) {
10435+ struct stat info;
10436+ if (0 == fstat(_fileno(in), &info)) {
10437+ // Must reserve 2 bytes at the end for FLEX terminator.
10438+ buffer = zret.result().alloc(info.st_size + 2);
10439+ if (buffer._ptr) {
10440+ size_t n;
10441+ if (0 < (n = fread(buffer._ptr, sizeof(char), info.st_size, in))) {
10442+ buffer._size = n + 2;
10443+ memset(buffer._ptr + n, 0, 2); // required by FLEX
10444+ zret = Builder(zret.result()).build(buffer);
10445+ } else {
10446+ msg::logf_errno(zret, msg::WARN, "failed to read %" PRIu64 " bytes from configuration file '%s'", info.st_size, path);
10447+ }
10448 } else {
10449- msg::logf_errno(zret, msg::WARN, "failed to read %" PRIu64 " bytes from configuration file '%s'", info.st_size, path);
10450+ msg::logf_errno(zret, msg::WARN, "failed to allocate buffer for configuration file '%s' - needed %" PRIu64 " bytes.",
10451+ path, info.st_size);
10452 }
10453 } else {
10454- msg::logf_errno(zret, msg::WARN, "failed to allocate buffer for configuration file '%s' - needed %" PRIu64 " bytes.", path, info.st_size);
10455+ msg::logf_errno(zret, msg::WARN, "failed to determine file information on '%s'", path);
10456 }
10457+ fclose(in);
10458 } else {
10459- msg::logf_errno(zret, msg::WARN, "failed to determine file information on '%s'", path);
10460+ msg::logf_errno(zret, msg::WARN, "failed to open configuration file '%s'", path);
10461 }
10462- fclose(in);
10463- } else {
10464- msg::logf_errno(zret, msg::WARN, "failed to open configuration file '%s'", path);
10465+ return zret;
10466 }
10467- return zret;
10468-}
10469
10470-}} // namespace ts::config
10471+} // namespace config
10472+} // namespace ts
10473diff --git a/lib/tsconfig/TsValue.h b/lib/tsconfig/TsValue.h
10474index 7d420dfe7..96bdeff88 100644
10475--- a/lib/tsconfig/TsValue.h
10476+++ b/lib/tsconfig/TsValue.h
10477@@ -1,5 +1,5 @@
10478-# if ! defined(TS_CONFIG_VALUE_HEADER)
10479-# define TS_CONFIG_VALUE_HEADER
10480+#if !defined(TS_CONFIG_VALUE_HEADER)
10481+#define TS_CONFIG_VALUE_HEADER
10482
10483 /** @file
10484
10485@@ -32,710 +32,821 @@
10486 #include <utility>
10487 #include <vector>
10488
10489-namespace ts { namespace config {
10490+namespace ts
10491+{
10492+namespace config
10493+{
10494+ // Forward declares.
10495+ class Value;
10496+ class Path;
10497+
10498+ namespace detail
10499+ {
10500+ /** Class to provide a "pseudo bool" value.
10501+ This is used as the return type for the positive logical operator
10502+ (the converse of @c operator! ). This makes a class directly
10503+ usable in logical expressions. It is like a pointer but @b not
10504+ convertible to anything else, and so avoiding any undesirable
10505+ automatic conversions and the resulting ambiguities.
10506+ */
10507+ struct PseudoBool {
10508+ typedef bool (PseudoBool::*Type)() const; ///< The type itself.
10509+ bool operator!() const; ///< A method to use for the @c true value.
10510+ static Type const TRUE; ///< The @c true equivalent.
10511+ static Type const FALSE; ///< The @c false equivalent.
10512+ };
10513+ } // namespace detail
10514+
10515+ /// Type of value.
10516+ enum ValueType {
10517+ VoidValue, ///< No value, invalid.
10518+ ListValue, ///< List of values.
10519+ GroupValue, ///< Group of values.
10520+ StringValue, ///< Text string.
10521+ IntegerValue, ///< Integer.
10522+ PathValue, ///< Path.
10523+ // Update N_VALUE_TYPES if you change the last enum value !!
10524+ };
10525+ /// Number of value types.
10526+ static size_t const N_VALUE_TYPES = PathValue + 1;
10527
10528-// Forward declares.
10529-class Value;
10530-class Path;
10531+ /** A path to a value in a configuration.
10532+ */
10533+ class Path
10534+ {
10535+ friend class Value;
10536
10537-namespace detail {
10538- /** Class to provide a "pseudo bool" value.
10539- This is used as the return type for the positive logical operator
10540- (the converse of @c operator! ). This makes a class directly
10541- usable in logical expressions. It is like a pointer but @b not
10542- convertible to anything else, and so avoiding any undesirable
10543- automatic conversions and the resulting ambiguities.
10544- */
10545- struct PseudoBool {
10546- typedef bool (PseudoBool::*Type)() const; ///< The type itself.
10547- bool operator ! () const; ///< A method to use for the @c true value.
10548- static Type const TRUE; ///< The @c true equivalent.
10549- static Type const FALSE; ///< The @c false equivalent.
10550- };
10551-}
10552-
10553-/// Type of value.
10554-enum ValueType {
10555- VoidValue, ///< No value, invalid.
10556- ListValue, ///< List of values.
10557- GroupValue, ///< Group of values.
10558- StringValue, ///< Text string.
10559- IntegerValue, ///< Integer.
10560- PathValue, ///< Path.
10561- // Update N_VALUE_TYPES if you change the last enum value !!
10562-};
10563-/// Number of value types.
10564-static size_t const N_VALUE_TYPES = PathValue + 1;
10565-
10566-/** A path to a value in a configuration.
10567- */
10568-class Path {
10569- friend class Value;
10570-protected:
10571- class ImplType : public IntrusivePtrCounter {
10572- friend class Path;
10573- public:
10574- ImplType(); ///< Constructor.
10575 protected:
10576- /** Container for path elements.
10577- We are subtle with our elements, which can be either a string
10578- or a numeric index. By convention, if the pointer in the buffer is
10579- @c NULL, then the size is a numeric index. Otherwise it's a name.
10580+ class ImplType : public IntrusivePtrCounter
10581+ {
10582+ friend class Path;
10583+
10584+ public:
10585+ ImplType(); ///< Constructor.
10586+ protected:
10587+ /** Container for path elements.
10588+ We are subtle with our elements, which can be either a string
10589+ or a numeric index. By convention, if the pointer in the buffer is
10590+ @c NULL, then the size is a numeric index. Otherwise it's a name.
10591+ */
10592+ typedef std::vector<ConstBuffer> Elements;
10593+ Elements _elements; ///< Path elements.
10594+ };
10595+
10596+ public:
10597+ typedef Path self; ///< Self reference type.
10598+
10599+ Path(); ///< Default constructor.
10600+
10601+ /// Append a string tag to the path.
10602+ self &append(ConstBuffer const &tag ///< Text of tag.
10603+ );
10604+ /// Append a numeric index to the path.
10605+ self &append(size_t idx ///< Index.
10606+ );
10607+ /// Reset to default constructed state.
10608+ self &reset();
10609+
10610+ /// Get the number of elements in this path.
10611+ size_t count() const;
10612+
10613+ /// Access an element by @a index.
10614+ ConstBuffer const &operator[](size_t index ///< Element index.
10615+ ) const;
10616+
10617+ /** Parser for path text.
10618+ This is restartable so a path can be parsed in pieces.
10619+ @internal Sadly, FLEX is just too much overhead to be useful here.
10620 */
10621- typedef std::vector<ConstBuffer> Elements;
10622- Elements _elements; ///< Path elements.
10623+ class Parser
10624+ {
10625+ public:
10626+ typedef Parser self; ///< Self reference type.
10627+
10628+ Parser(); ///< Default constructor.
10629+ /** Construct with input.
10630+
10631+ This default constructs the Parser then calls @c setInput with
10632+ @a text. It is provided as a convenience as that will be the
10633+ common use case.
10634+
10635+ @see setInput.
10636+ */
10637+ Parser(ConstBuffer const &text ///< Input text.
10638+ );
10639+
10640+ /** Set the input @a text.
10641+ Parsing state is reset and the next parsing call will
10642+ start at the beginning of @a text.
10643+ */
10644+ self &setInput(ConstBuffer const &text ///< Input buffer.
10645+ );
10646+
10647+ /// Parsing result.
10648+ enum Result {
10649+ ERROR, ///< Bad input.
10650+ TAG, ///< Path tag.
10651+ INDEX, ///< Path index.
10652+ EOP, ///< End Of Path.
10653+ };
10654+
10655+ /** Parse the next element in the path.
10656+
10657+ @a cbuff may be @c NULL in which case no data about elements
10658+ is available. In general this should be called until @c EOP
10659+ or @c ERROR is returned, each call returning the next element.
10660+
10661+ @return A parse @c Result.
10662+ - TAG: A tag was found. The start and length are stored in @a cbuff.
10663+ - INDEX: An index was found. The value is in @a cbuff._size.
10664+ - EOP: No more path elements were found. Do not continue parsing.
10665+ - ERROR: A syntax error was encountered. See the errata for detail. Do not continue parsing.
10666+ */
10667+ Rv<Result> parse(ConstBuffer *cbuff = nullptr ///< [out] Parsed path element.
10668+ );
10669+
10670+ /// Check if input is available.
10671+ bool hasInput() const;
10672+
10673+ protected:
10674+ ConstBuffer _input; ///< Current input buffer.
10675+ char const *_c; ///< Next input character.
10676+ };
10677+
10678+ protected:
10679+ typedef IntrusivePtr<ImplType> ImplPtr; ///< Smart pointer to implementation.
10680+ ImplPtr _ptr; ///< Our instance.
10681+ /// Force an implementation instance and return a pointer to it.
10682+ ImplType *instance();
10683 };
10684-public:
10685- typedef Path self; ///< Self reference type.
10686-
10687- Path(); ///< Default constructor.
10688-
10689- /// Append a string tag to the path.
10690- self& append(
10691- ConstBuffer const& tag ///< Text of tag.
10692- );
10693- /// Append a numeric index to the path.
10694- self& append(
10695- size_t idx ///< Index.
10696- );
10697- /// Reset to default constructed state.
10698- self& reset();
10699-
10700- /// Get the number of elements in this path.
10701- size_t count() const;
10702-
10703- /// Access an element by @a index.
10704- ConstBuffer const& operator [] (
10705- size_t index ///< Element index.
10706- ) const;
10707-
10708- /** Parser for path text.
10709- This is restartable so a path can be parsed in pieces.
10710- @internal Sadly, FLEX is just too much overhead to be useful here.
10711- */
10712- class Parser {
10713- public:
10714- typedef Parser self; ///< Self reference type.
10715
10716- Parser(); ///< Default constructor.
10717- /** Construct with input.
10718+ namespace detail
10719+ {
10720+ /// Null buffer, handy in several places.
10721+ extern Buffer const NULL_BUFFER;
10722+ /// Null buffer, handy in several places.
10723+ extern ConstBuffer const NULL_CONST_BUFFER;
10724+ /// Index type for value items in the global table.
10725+ typedef NumericType<size_t, struct ValueIndexTag> ValueIndex;
10726+ /// Index value that presents NULL (invalid value).
10727+ static ValueIndex const NULL_VALUE_INDEX = static_cast<ValueIndex::raw_type>(-1);
10728+ /// Numeric type for configuration generation.
10729+ typedef NumericType<size_t, struct GenerationTag> Generation;
10730+
10731+ /** Value type properties.
10732+ These are used as bit masks on elements of an array.
10733+ */
10734+ static unsigned int const IS_VALID = 1;
10735+ static unsigned int const IS_LITERAL = 1 << 1;
10736+ static unsigned int const IS_CONTAINER = 1 << 2;
10737
10738- This default constructs the Parser then calls @c setInput with
10739- @a text. It is provided as a convenience as that will be the
10740- common use case.
10741+ /// Value type property table.
10742+ extern unsigned int const Type_Property[N_VALUE_TYPES];
10743
10744- @see setInput.
10745+ /** A value in the configuration.
10746+ This is used in a global table so it handles all types of Values.
10747+ Members that are not used for scalars are designed to be @c NULL
10748+ pointers in that case.
10749 */
10750- Parser(
10751- ConstBuffer const& text ///< Input text.
10752- );
10753+ class ValueItem
10754+ {
10755+ // Apparently the C++ standard, 7.3.1.2, states that unqualified
10756+ // friend classes only considers the current namespace, not any
10757+ // outer ones. So we have to fully qualify this. Blech.
10758+ friend class ts::config::Value;
10759+ friend class ValueTable;
10760+
10761+ public:
10762+ /// Default constructor.
10763+ ValueItem();
10764+ /// Construct empty item of a specific type.
10765+ ValueItem(ValueType type);
10766+ /// Get item type.
10767+ ValueType getType() const;
10768+
10769+ protected:
10770+ ValueType _type = VoidValue; ///< Type of value.
10771+ ValueIndex _parent = 0; ///< Table index of parent value.
10772+ ConstBuffer _text; ///< Text of value (if scalar).
10773+ ConstBuffer _name; ///< Local name of value, if available.
10774+ size_t _local_index = 0; ///< Index among siblings.
10775+ int _srcLine = 0; ///< Source line.
10776+ int _srcColumn = 0; ///< Source column.
10777+
10778+ /// Container for children of this item.
10779+ typedef std::vector<ValueIndex> ChildGroup;
10780+ /// Child items of this item.
10781+ ChildGroup _children;
10782+ /// Path if present.
10783+ Path _path;
10784+
10785+ // This is for optimizing named access at some point in the future.
10786+ /// Hold a child item name in a table for fast lookup.
10787+ struct Name {
10788+ ConstBuffer _text; ///< Text of name.
10789+ ValueIndex _index; ///< Index of child.
10790+ };
10791+ /// Container for child names.
10792+ typedef std::vector<Name> NameGroup;
10793+ /** Child names, if appropriate.
10794+ This is faulted in when needed, if this value is an aggregate with
10795+ named children. The list must be sorted on name so that it can be binary
10796+ searched for performance.
10797+ */
10798+ NameGroup _names;
10799+ };
10800+
10801+ class ValueTable;
10802
10803- /** Set the input @a text.
10804- Parsing state is reset and the next parsing call will
10805- start at the beginning of @a text.
10806+ /** Table of configuration values.
10807+ This holds all the values for a specific configuration.
10808 */
10809- self& setInput(
10810- ConstBuffer const& text ///< Input buffer.
10811- );
10812+ class ValueTableImpl : public IntrusivePtrCounter
10813+ {
10814+ friend class ValueTable;
10815+
10816+ public:
10817+ typedef ValueTableImpl self; ///< Self reference type.
10818+
10819+ ValueTableImpl(); ///< Constructor.
10820+ ~ValueTableImpl(); ///< Destructor.
10821+ protected:
10822+ /// Container for value items.
10823+ typedef std::vector<ValueItem> ItemTable;
10824+ ItemTable _values; ///< All configuration values.
10825+ Generation _generation; ///< Generation number of configuration.
10826+ /// A group of buffers.
10827+ typedef std::vector<Buffer> BufferGroup;
10828+ /** Locally allocated buffers.
10829+ These are freed when this object is destroyed.
10830+ */
10831+ BufferGroup _buffers;
10832+
10833+ static ValueItem NULL_ITEM; ///< Null item for invalid access return.
10834+ };
10835
10836- /// Parsing result.
10837- enum Result {
10838- ERROR, ///< Bad input.
10839- TAG, ///< Path tag.
10840- INDEX, ///< Path index.
10841- EOP, ///< End Of Path.
10842+ /** Wrapper class for a table of configuration values.
10843+ @internal Really, this should be merged in to Configuration. The original
10844+ differences have evolved out of the implementation.
10845+ */
10846+ class ValueTable
10847+ {
10848+ public:
10849+ typedef ValueTable self; ///< Self reference type.
10850+ typedef ValueTableImpl ImplType; ///< Implementation type.
10851+
10852+ /// Table size.
10853+ /// @return The number of value items in the table.
10854+ size_t size() const;
10855+ /// Generation.
10856+ /// @return The generation number.
10857+ Generation generation() const;
10858+
10859+ /// Const access by index.
10860+ /// @return The value item at index @a idx.
10861+ ValueItem const &operator[](ValueIndex idx ///< Index of item.
10862+ ) const;
10863+ /// Access by index.
10864+ /// @return The value item at index @a idx.
10865+ ValueItem &operator[](ValueIndex idx ///< Index of item.
10866+ );
10867+
10868+ /// Force the existence of the root item in the table.
10869+ /// @return @c this object.
10870+ self &forceRootItem();
10871+ /** Create a new item (value) with optional @a name
10872+ The table must contain @a parent. If @a name is omitted, the item
10873+ has an empty name.
10874+ @return Index of the new value item.
10875+ */
10876+ Rv<ValueIndex> make(ValueIndex parent, ///< Index of parent for item.
10877+ ValueType type, ///< Type of item.
10878+ ConstBuffer const &name = NULL_BUFFER ///< Name (may be empty).
10879+ );
10880+
10881+ /// Test for not table existence.
10882+ /// @return @c false if the implementation instance exists, @c true if not.
10883+ bool operator!() const;
10884+ /// Test for table existence.
10885+ /// @return @c true if the implementation instance exists, @c false if not.
10886+ operator PseudoBool::Type() const;
10887+ /// Reset to default constructed state.
10888+ /// @return @c this object.
10889+ self &reset();
10890+
10891+ /** Allocate a local buffer.
10892+ This buffer will persist until the implementation instance
10893+ is destoyed.
10894+ @return The allocated buffer.
10895+ */
10896+ Buffer alloc(size_t n);
10897+
10898+ protected:
10899+ typedef IntrusivePtr<ImplType> ImplPtr; ///< Smart pointer to implementation instance.
10900+ ImplPtr _ptr; ///< Implementation instance.
10901+
10902+ /// Force an implementation instance and return a pointer to it.
10903+ ImplType *instance();
10904 };
10905+ } // namespace detail
10906
10907- /** Parse the next element in the path.
10908+ /** Container for a configuration.
10909+ This is a wrapper class that holds a shared reference to a configuration.
10910+ */
10911+ class Configuration
10912+ {
10913+ friend class Value;
10914
10915- @a cbuff may be @c NULL in which case no data about elements
10916- is available. In general this should be called until @c EOP
10917- or @c ERROR is returned, each call returning the next element.
10918+ public:
10919+ typedef Configuration self; ///< Self reference type.
10920+
10921+ /** Check if configuration is (not) valid.
10922+ @return @c true if this configuration is invalid, @c false otherwise.
10923+ */
10924+ bool operator!() const;
10925+ /** Check if the configuration is valid.
10926+ @return The equivalent of @c true if this does @b not contain a value,
10927+ the equivalent of @c false if it does.
10928+ */
10929+ operator detail::PseudoBool::Type() const;
10930+ /** Get the root @c Value of the configuration.
10931+ The root is always a group and has no name.
10932+ @return The root value.
10933+ */
10934+ Value getRoot() const;
10935
10936- @return A parse @c Result.
10937- - TAG: A tag was found. The start and length are stored in @a cbuff.
10938- - INDEX: An index was found. The value is in @a cbuff._size.
10939- - EOP: No more path elements were found. Do not continue parsing.
10940- - ERROR: A syntax error was encountered. See the errata for detail. Do not continue parsing.
10941+ /// Get the number of child values on the root value.
10942+ size_t childCount() const;
10943+ /** Root value child access by @a index
10944+ @return The child or a @c Void value if there is no child with @a name.
10945 */
10946- Rv<Result> parse(
10947- ConstBuffer* cbuff = nullptr ///< [out] Parsed path element.
10948+ Value operator[](size_t idx ///< Index of child value.
10949+ ) const;
10950+ /** Root value child access by @a name.
10951+ @return The child or a @c Void value if there is no child with @a name.
10952+ */
10953+ Value operator[](ConstBuffer const &name) const;
10954+ /** Root value child access by @a name.
10955+ @return The child or a @c Void value if there is no child with @a name.
10956+ */
10957+ Value operator[](char const *name ///< Null terminated string.
10958+ ) const;
10959+
10960+ /** Find a value.
10961+ @return The value if found, an void valid if not.
10962+ */
10963+ Value find(char const *path ///< configuration path to value.
10964 );
10965+ /** Load a configuration from a file.
10966
10967- /// Check if input is available.
10968- bool hasInput() const;
10969+ @note Check the returned errata for problems during configuration
10970+ load. It is probably not a good idea to use the configuration in
10971+ any error are reported.
10972+ @return A new @c Configuration and errata.
10973+ */
10974+ static Rv<self> loadFromPath(char const *path ///< file system path.
10975+ );
10976+ /** Allocate a local buffer of size @a n.
10977+ This buffer will persist until the implementation instance
10978+ is destroyed.
10979+ @return The allocated buffer.
10980+ */
10981+ Buffer alloc(size_t n ///< requested size of buffer.
10982+ );
10983
10984 protected:
10985- ConstBuffer _input; ///< Current input buffer.
10986- char const* _c; ///< Next input character.
10987+ detail::ValueTable _table; ///< Table of values from the configuration.
10988 };
10989-protected:
10990- typedef IntrusivePtr<ImplType> ImplPtr; ///< Smart pointer to implementation.
10991- ImplPtr _ptr; ///< Our instance.
10992- /// Force an implementation instance and return a pointer to it.
10993- ImplType* instance();
10994-};
10995-
10996-namespace detail {
10997- /// Null buffer, handy in several places.
10998- extern Buffer const NULL_BUFFER;
10999- /// Null buffer, handy in several places.
11000- extern ConstBuffer const NULL_CONST_BUFFER;
11001- /// Index type for value items in the global table.
11002- typedef NumericType<size_t, struct ValueIndexTag> ValueIndex;
11003- /// Index value that presents NULL (invalid value).
11004- static ValueIndex const NULL_VALUE_INDEX = static_cast<ValueIndex::raw_type>(-1);
11005- /// Numeric type for configuration generation.
11006- typedef NumericType<size_t, struct GenerationTag> Generation;
11007-
11008- /** Value type properties.
11009- These are used as bit masks on elements of an array.
11010- */
11011- static unsigned int const IS_VALID = 1;
11012- static unsigned int const IS_LITERAL = 1<<1;
11013- static unsigned int const IS_CONTAINER = 1<<2;
11014
11015- /// Value type property table.
11016- extern unsigned int const Type_Property[N_VALUE_TYPES];
11017+ /** This holds a value from the configuration.
11018
11019- /** A value in the configuration.
11020- This is used in a global table so it handles all types of Values.
11021- Members that are not used for scalars are designed to be @c NULL
11022- pointers in that case.
11023+ @internal It is critical that none of the type specific subclasses define any data members
11024+ so that instances can be freely converted to and from this base class.
11025 */
11026- class ValueItem {
11027- // Apparently the C++ standard, 7.3.1.2, states that unqualified
11028- // friend classes only considers the current namespace, not any
11029- // outer ones. So we have to fully qualify this. Blech.
11030- friend class ts::config::Value;
11031- friend class ValueTable;
11032+ class Value
11033+ {
11034+ friend class Configuration;
11035+
11036 public:
11037- /// Default constructor.
11038- ValueItem();
11039- /// Construct empty item of a specific type.
11040- ValueItem(ValueType type);
11041- /// Get item type.
11042+ typedef Value self; ///< Self reference type.
11043+ /// Default constructors.
11044+ /// Creates an @c NULL instance.
11045+ Value();
11046+ /// Destructor.
11047+ ~Value();
11048+
11049+ /// Get the type of value.
11050 ValueType getType() const;
11051- protected:
11052- ValueType _type = VoidValue; ///< Type of value.
11053- ValueIndex _parent = 0; ///< Table index of parent value.
11054- ConstBuffer _text; ///< Text of value (if scalar).
11055- ConstBuffer _name; ///< Local name of value, if available.
11056- size_t _local_index = 0; ///< Index among siblings.
11057- int _srcLine = 0; ///< Source line.
11058- int _srcColumn = 0; ///< Source column.
11059-
11060- /// Container for children of this item.
11061- typedef std::vector<ValueIndex> ChildGroup;
11062- /// Child items of this item.
11063- ChildGroup _children;
11064- /// Path if present.
11065- Path _path;
11066-
11067- // This is for optimizing named access at some point in the future.
11068- /// Hold a child item name in a table for fast lookup.
11069- struct Name {
11070- ConstBuffer _text; ///< Text of name.
11071- ValueIndex _index; ///< Index of child.
11072- };
11073- /// Container for child names.
11074- typedef std::vector<Name> NameGroup;
11075- /** Child names, if appropriate.
11076- This is faulted in when needed, if this value is an aggregate with
11077- named children. The list must be sorted on name so that it can be binary
11078- searched for performance.
11079+ /// Test if this is a valid value.
11080+ /// @return @c true if this contains a value, @c false otherwise.
11081+ bool hasValue() const;
11082+ /** Operator form of @c hasValue.
11083+ @see hasValue
11084+ @return @c true if this does @b not contain a value, @c false if it does.
11085 */
11086- NameGroup _names;
11087- };
11088+ bool operator!() const;
11089+ /** Logical form of @c hasValue for use in logical expressions.
11090+ @see hasValue
11091+ @return The equivalent of @c true if this does @b not contain a value,
11092+ the equivalent of @c false if it does.
11093+ */
11094+ operator detail::PseudoBool::Type() const;
11095
11096- class ValueTable;
11097+ /** Get the value text.
11098+ @return The text in the configuration file for this item if the item
11099+ is a scalar, an empty buffer otherwise.
11100+ */
11101+ ConstBuffer const &getText() const;
11102+ /// Set the @a text for this value.
11103+ self &setText(ConstBuffer const &text);
11104+
11105+ /** Get local name.
11106+ This gets the local name of the value. That is the name by which it
11107+ is known to its parent container.
11108+
11109+ @internal Only works for groups now. It should be made to work
11110+ for lists. This would require allocating strings for each index,
11111+ which should be shared across values. For instance, all values
11112+ at index 1 should return the same string "1", not separately
11113+ allocated for each value.
11114+ */
11115+ ConstBuffer const &getName() const;
11116+ /** Get local index.
11117+ This gets the local index for the value. This is the index which,
11118+ if used on the parent, would yield this value.
11119+ @return The local index.
11120+ */
11121+ size_t getIndex() const;
11122+
11123+ /// Test for a literal value.
11124+ /// @return @c true if the value is a literal,
11125+ /// @c false if it is a container or invalid.
11126+ bool isLiteral() const;
11127+ /// Test for value container.
11128+ /// @return @c true if the value is a container (can have child values),
11129+ /// @c false otherwise.
11130+ bool isContainer() const;
11131+ /// Get the parent value.
11132+ Value getParent() const;
11133+ /// Test if this is the root value for the configuration.
11134+ bool isRoot() const;
11135+
11136+ /// Get the number of child values.
11137+ size_t childCount() const;
11138+ /** Child access by @a index
11139+ @return The child or a @c Void value if there is no child with @a name.
11140+ */
11141+ Value operator[](size_t idx ///< Index of child value.
11142+ ) const;
11143+ /** Child access by @a name.
11144+ @return The child or a @c Void value if there is no child with @a name.
11145+ */
11146+ Value operator[](ConstBuffer const &name) const;
11147+ /** Child access by @a name.
11148+ @return The child or a @c Void value if there is no child with @a name.
11149+ */
11150+ Value operator[](char const *name ///< Null terminated string.
11151+ ) const;
11152
11153- /** Table of configuration values.
11154- This holds all the values for a specific configuration.
11155- */
11156- class ValueTableImpl : public IntrusivePtrCounter {
11157- friend class ValueTable;
11158- public:
11159- typedef ValueTableImpl self; ///< Self reference type.
11160+ /** @name Creating child values.
11161
11162- ValueTableImpl(); ///< Constructor.
11163- ~ValueTableImpl(); ///< Destructor.
11164- protected:
11165- /// Container for value items.
11166- typedef std::vector<ValueItem> ItemTable;
11167- ItemTable _values; ///< All configuration values.
11168- Generation _generation; ///< Generation number of configuration.
11169- /// A group of buffers.
11170- typedef std::vector<Buffer> BufferGroup;
11171- /** Locally allocated buffers.
11172- These are freed when this object is destroyed.
11173- */
11174- BufferGroup _buffers;
11175+ These methods all take an optional @a name argument. This is
11176+ required if @c this is a @c Group and ignored if @c this is a @c
11177+ List.
11178
11179- static ValueItem NULL_ITEM; ///< Null item for invalid access return.
11180- };
11181+ These methods will fail if
11182+ - @c this is not a container.
11183+ - @c this is a @c Group and no @a name is provided.
11184
11185- /** Wrapper class for a table of configuration values.
11186- @internal Really, this should be merged in to Configuration. The original
11187- differences have evolved out of the implementation.
11188- */
11189- class ValueTable {
11190- public:
11191- typedef ValueTable self; ///< Self reference type.
11192- typedef ValueTableImpl ImplType; ///< Implementation type.
11193-
11194- /// Table size.
11195- /// @return The number of value items in the table.
11196- size_t size() const;
11197- /// Generation.
11198- /// @return The generation number.
11199- Generation generation() const;
11200-
11201- /// Const access by index.
11202- /// @return The value item at index @a idx.
11203- ValueItem const& operator [] (
11204- ValueIndex idx ///< Index of item.
11205- ) const;
11206- /// Access by index.
11207- /// @return The value item at index @a idx.
11208- ValueItem& operator [] (
11209- ValueIndex idx ///< Index of item.
11210+ @note Currently for groups, duplicate names are not
11211+ detected. The duplicates will be inaccessible by name but can
11212+ still be found by index. This is a problem but I am still
11213+ pondering the appropriate solution.
11214+
11215+ @see isContainer
11216+ @return The new value, or an invalid value plus errata on failure.
11217+
11218+ @internal I original had this as a single method, but changed to
11219+ separate per type. Overall less ugly because we can get the
11220+ arguments more useful.
11221+ */
11222+ //@{
11223+ /// Create a @c String value.
11224+ Rv<Value> makeString(ConstBuffer const &text, ///< String content.
11225+ ConstBuffer const &name = detail::NULL_BUFFER ///< Optional name of value.
11226+ );
11227+ /// Create an @c Integer value.
11228+ Rv<Value> makeInteger(ConstBuffer const &text, ///< Text of number.
11229+ ConstBuffer const &name = detail::NULL_BUFFER ///< Optional name of value.
11230+ );
11231+ /// Create a @c Group value.
11232+ Rv<Value> makeGroup(ConstBuffer const &name = detail::NULL_BUFFER ///< Optional name of value.
11233+ );
11234+ /// Create a @c List value.
11235+ Rv<Value> makeList(ConstBuffer const &name = detail::NULL_BUFFER ///< Optional name of value.
11236 );
11237+ /// Create a @c Path value.
11238+ Rv<Value> makePath(Path const &path, ///< Path.
11239+ ConstBuffer const &name = detail::NULL_BUFFER ///< Optional name of value.
11240+ );
11241+ /// Create a child by type.
11242+ /// Client must fill in any other required elements.
11243+ Rv<Value> makeChild(ValueType type, ///< Type of child.
11244+ ConstBuffer const &name = detail::NULL_BUFFER ///< Optional name of value.
11245+ );
11246+ //@}
11247
11248- /// Force the existence of the root item in the table.
11249- /// @return @c this object.
11250- self& forceRootItem();
11251- /** Create a new item (value) with optional @a name
11252- The table must contain @a parent. If @a name is omitted, the item
11253- has an empty name.
11254- @return Index of the new value item.
11255+ /** Find a value.
11256+ @return The value if found, an void valid if not.
11257 */
11258- Rv<ValueIndex> make(
11259- ValueIndex parent, ///< Index of parent for item.
11260- ValueType type, ///< Type of item.
11261- ConstBuffer const& name = NULL_BUFFER ///< Name (may be empty).
11262+ Value find(ConstBuffer const &path ///< Path relative to this value.
11263+ );
11264+ /** Find a value.
11265+ @return The value if found, an void valid if not.
11266+ */
11267+ Value find(char const *path ///< Path relative to this value.
11268+ );
11269+ /** Find a value using a precondensed path.
11270+ @return The value if found, an void valid if not.
11271+ */
11272+ Value find(Path const &path ///< Path relative to this value.
11273 );
11274
11275- /// Test for not table existence.
11276- /// @return @c false if the implementation instance exists, @c true if not.
11277- bool operator ! () const;
11278- /// Test for table existence.
11279- /// @return @c true if the implementation instance exists, @c false if not.
11280- operator PseudoBool::Type() const;
11281- /// Reset to default constructed state.
11282+ /** Reset to default constructed state.
11283+ @note This wrapper is reset, the value in the configuration is unchanged.
11284+ @return @c this object.
11285+ */
11286+ self &reset();
11287+
11288+ /// Set source line.
11289+ /// @return @c this object.
11290+ self &setSourceLine(int line ///< Line in source stream.
11291+ );
11292+ /// Set source column.
11293 /// @return @c this object.
11294- self& reset();
11295+ self &setSourceColumn(int col ///< Column in source stream.
11296+ );
11297+ /// Set the source location.
11298+ self &setSource(int line, ///< Line in source stream.
11299+ int col ///< Column in source stream.
11300+ );
11301+ /// Get source line.
11302+ /// @return The line in the source stream for this value.
11303+ int getSourceLine() const;
11304+ /// Get source column.
11305+ /// @return The column in the source stream for this value.
11306+ int getSourceColumn() const;
11307
11308- /** Allocate a local buffer.
11309- This buffer will persist until the implementation instance
11310- is destoyed.
11311- @return The allocated buffer.
11312- */
11313- Buffer alloc(size_t n);
11314 protected:
11315- typedef IntrusivePtr<ImplType> ImplPtr; ///< Smart pointer to implementation instance.
11316- ImplPtr _ptr; ///< Implementation instance.
11317+ // Note: We store an index and not a pointer because a pointer will go stale
11318+ // if any items are added or removed from the underlying table.
11319+ // Also, by storing the configuration, we hold it in memory as long as a Value
11320+ // is in client hands.
11321+ Configuration _config; ///< The configuration for this value.
11322+ detail::ValueIndex _vidx; ///< Index of item.
11323+
11324+ static Buffer const NULL_BUFFER; ///< Empty buffer to return on method failures.
11325+
11326+ /// Construct from raw data.
11327+ Value(Configuration cfg, ///< Source configuration.
11328+ detail::ValueIndex vidx ///< Index of value.
11329+ );
11330
11331- /// Force an implementation instance and return a pointer to it.
11332- ImplType* instance();
11333+ /** Get raw item pointer.
11334+ @note This pointer is unstable and must be recomputed on each method invocation.
11335+ @return The item pointer or @c NULL if this value is invalid.
11336+ */
11337+ detail::ValueItem *item();
11338+ /** Get constant raw item pointer.
11339+ @note This pointer is unstable and must be recomputed on each method invocation.
11340+ @return The item pointer or @c NULL if this value is invalid.
11341+ */
11342+ detail::ValueItem const *item() const;
11343 };
11344-} // namespace detail
11345-
11346-/** Container for a configuration.
11347- This is a wrapper class that holds a shared reference to a configuration.
11348-*/
11349-class Configuration {
11350- friend class Value;
11351-public:
11352- typedef Configuration self; ///< Self reference type.
11353-
11354- /** Check if configuration is (not) valid.
11355- @return @c true if this configuration is invalid, @c false otherwise.
11356- */
11357- bool operator ! () const;
11358- /** Check if the configuration is valid.
11359- @return The equivalent of @c true if this does @b not contain a value,
11360- the equivalent of @c false if it does.
11361- */
11362- operator detail::PseudoBool::Type () const;
11363- /** Get the root @c Value of the configuration.
11364- The root is always a group and has no name.
11365- @return The root value.
11366- */
11367- Value getRoot() const;
11368-
11369- /// Get the number of child values on the root value.
11370- size_t childCount() const;
11371- /** Root value child access by @a index
11372- @return The child or a @c Void value if there is no child with @a name.
11373- */
11374- Value operator [] (
11375- size_t idx ///< Index of child value.
11376- ) const;
11377- /** Root value child access by @a name.
11378- @return The child or a @c Void value if there is no child with @a name.
11379- */
11380- Value operator [] (
11381- ConstBuffer const& name
11382- ) const;
11383- /** Root value child access by @a name.
11384- @return The child or a @c Void value if there is no child with @a name.
11385- */
11386- Value operator [] (
11387- char const* name ///< Null terminated string.
11388- ) const;
11389-
11390- /** Find a value.
11391- @return The value if found, an void valid if not.
11392- */
11393- Value find(
11394- char const* path ///< configuration path to value.
11395- );
11396- /** Load a configuration from a file.
11397-
11398- @note Check the returned errata for problems during configuration
11399- load. It is probably not a good idea to use the configuration in
11400- any error are reported.
11401- @return A new @c Configuration and errata.
11402- */
11403- static Rv<self> loadFromPath(
11404- char const* path ///< file system path.
11405- );
11406- /** Allocate a local buffer of size @a n.
11407- This buffer will persist until the implementation instance
11408- is destroyed.
11409- @return The allocated buffer.
11410- */
11411- Buffer alloc(
11412- size_t n ///< requested size of buffer.
11413- );
11414-protected:
11415- detail::ValueTable _table; ///< Table of values from the configuration.
11416-};
11417-
11418-/** This holds a value from the configuration.
11419-
11420- @internal It is critical that none of the type specific subclasses define any data members
11421- so that instances can be freely converted to and from this base class.
11422-*/
11423-class Value {
11424- friend class Configuration;
11425-public:
11426- typedef Value self; ///< Self reference type.
11427- /// Default constructors.
11428- /// Creates an @c NULL instance.
11429- Value();
11430- /// Destructor.
11431- ~Value();
11432-
11433- /// Get the type of value.
11434- ValueType getType() const;
11435- /// Test if this is a valid value.
11436- /// @return @c true if this contains a value, @c false otherwise.
11437- bool hasValue() const;
11438- /** Operator form of @c hasValue.
11439- @see hasValue
11440- @return @c true if this does @b not contain a value, @c false if it does.
11441- */
11442- bool operator ! () const;
11443- /** Logical form of @c hasValue for use in logical expressions.
11444- @see hasValue
11445- @return The equivalent of @c true if this does @b not contain a value,
11446- the equivalent of @c false if it does.
11447- */
11448- operator detail::PseudoBool::Type () const;
11449-
11450- /** Get the value text.
11451- @return The text in the configuration file for this item if the item
11452- is a scalar, an empty buffer otherwise.
11453- */
11454- ConstBuffer const& getText() const;
11455- /// Set the @a text for this value.
11456- self& setText(
11457- ConstBuffer const& text
11458- );
11459-
11460- /** Get local name.
11461- This gets the local name of the value. That is the name by which it
11462- is known to its parent container.
11463-
11464- @internal Only works for groups now. It should be made to work
11465- for lists. This would require allocating strings for each index,
11466- which should be shared across values. For instance, all values
11467- at index 1 should return the same string "1", not separately
11468- allocated for each value.
11469- */
11470- ConstBuffer const& getName() const;
11471- /** Get local index.
11472- This gets the local index for the value. This is the index which,
11473- if used on the parent, would yield this value.
11474- @return The local index.
11475- */
11476- size_t getIndex() const;
11477-
11478- /// Test for a literal value.
11479- /// @return @c true if the value is a literal,
11480- /// @c false if it is a container or invalid.
11481- bool isLiteral() const;
11482- /// Test for value container.
11483- /// @return @c true if the value is a container (can have child values),
11484- /// @c false otherwise.
11485- bool isContainer() const;
11486- /// Get the parent value.
11487- Value getParent() const;
11488- /// Test if this is the root value for the configuration.
11489- bool isRoot() const;
11490-
11491- /// Get the number of child values.
11492- size_t childCount() const;
11493- /** Child access by @a index
11494- @return The child or a @c Void value if there is no child with @a name.
11495- */
11496- Value operator [] (
11497- size_t idx ///< Index of child value.
11498- ) const;
11499- /** Child access by @a name.
11500- @return The child or a @c Void value if there is no child with @a name.
11501- */
11502- Value operator [] (
11503- ConstBuffer const& name
11504- ) const;
11505- /** Child access by @a name.
11506- @return The child or a @c Void value if there is no child with @a name.
11507- */
11508- Value operator [] (
11509- char const* name ///< Null terminated string.
11510- ) const;
11511
11512- /** @name Creating child values.
11513+ // Inline methods.
11514+ namespace detail
11515+ {
11516+ inline bool ValueTable::operator!() const { return !_ptr; }
11517+ inline ValueTable::operator PseudoBool::Type() const { return _ptr ? PseudoBool::TRUE : PseudoBool::FALSE; }
11518+ inline size_t
11519+ ValueTable::size() const
11520+ {
11521+ return _ptr ? _ptr->_values.size() : 0;
11522+ }
11523+ inline Generation
11524+ ValueTable::generation() const
11525+ {
11526+ return _ptr ? _ptr->_generation : Generation(0);
11527+ }
11528+ inline ValueItem const &ValueTable::operator[](ValueIndex idx) const { return const_cast<self *>(this)->operator[](idx); }
11529+ inline ValueTable &
11530+ ValueTable::reset()
11531+ {
11532+ _ptr.reset();
11533+ return *this;
11534+ }
11535+
11536+ inline ValueItem::ValueItem() {}
11537+ inline ValueItem::ValueItem(ValueType type) : _type(type) {}
11538+ inline ValueType
11539+ ValueItem::getType() const
11540+ {
11541+ return _type;
11542+ }
11543+ } // namespace detail
11544+
11545+ inline Value::~Value() {}
11546+ inline Value::Value() : _vidx(detail::NULL_VALUE_INDEX) {}
11547+ inline Value::Value(Configuration cfg, detail::ValueIndex vidx) : _config(std::move(cfg)), _vidx(vidx) {}
11548+ inline bool
11549+ Value::hasValue() const
11550+ {
11551+ return _config && _vidx != detail::NULL_VALUE_INDEX;
11552+ }
11553+ inline Value::operator detail::PseudoBool::Type() const
11554+ {
11555+ return this->hasValue() ? detail::PseudoBool::TRUE : detail::PseudoBool::FALSE;
11556+ }
11557+ inline bool Value::operator!() const { return !this->hasValue(); }
11558+ inline ValueType
11559+ Value::getType() const
11560+ {
11561+ return this->hasValue() ? _config._table[_vidx]._type : VoidValue;
11562+ }
11563+ inline ConstBuffer const &
11564+ Value::getText() const
11565+ {
11566+ return this->hasValue() ? _config._table[_vidx]._text : detail::NULL_CONST_BUFFER;
11567+ }
11568+ inline Value &
11569+ Value::setText(ConstBuffer const &text)
11570+ {
11571+ detail::ValueItem *item = this->item();
11572+ if (item)
11573+ item->_text = text;
11574+ return *this;
11575+ }
11576+ inline ConstBuffer const &
11577+ Value::getName() const
11578+ {
11579+ detail::ValueItem const *item = this->item();
11580+ return item ? item->_name : detail::NULL_CONST_BUFFER;
11581+ }
11582+ inline size_t
11583+ Value::getIndex() const
11584+ {
11585+ detail::ValueItem const *item = this->item();
11586+ return item ? item->_local_index : 0;
11587+ }
11588
11589- These methods all take an optional @a name argument. This is
11590- required if @c this is a @c Group and ignored if @c this is a @c
11591- List.
11592+ inline bool
11593+ Value::isLiteral() const
11594+ {
11595+ return 0 != (detail::IS_LITERAL & detail::Type_Property[this->getType()]);
11596+ }
11597+ inline bool
11598+ Value::isContainer() const
11599+ {
11600+ return 0 != (detail::IS_CONTAINER & detail::Type_Property[this->getType()]);
11601+ }
11602+ inline Value
11603+ Value::getParent() const
11604+ {
11605+ return this->hasValue() ? Value(_config, _config._table[_vidx]._parent) : Value();
11606+ }
11607+ inline bool
11608+ Value::isRoot() const
11609+ {
11610+ return this->hasValue() && _vidx == 0;
11611+ }
11612+ inline Value &
11613+ Value::reset()
11614+ {
11615+ _config = Configuration();
11616+ _vidx = detail::NULL_VALUE_INDEX;
11617+ return *this;
11618+ }
11619+ inline detail::ValueItem *
11620+ Value::item()
11621+ {
11622+ return this->hasValue() ? &(_config._table[_vidx]) : nullptr;
11623+ }
11624+ inline detail::ValueItem const *
11625+ Value::item() const
11626+ {
11627+ return const_cast<self *>(this)->item();
11628+ }
11629+ inline Value Value::operator[](char const *name) const { return (*this)[ConstBuffer(name, strlen(name))]; }
11630+ inline size_t
11631+ Value::childCount() const
11632+ {
11633+ detail::ValueItem const *item = this->item();
11634+ return item ? item->_children.size() : 0;
11635+ }
11636+ inline Value
11637+ Value::find(char const *path)
11638+ {
11639+ return this->find(ConstBuffer(path, strlen(path)));
11640+ }
11641+ inline int
11642+ Value::getSourceLine() const
11643+ {
11644+ detail::ValueItem const *item = this->item();
11645+ return item ? item->_srcLine : 0;
11646+ }
11647+ inline int
11648+ Value::getSourceColumn() const
11649+ {
11650+ detail::ValueItem const *item = this->item();
11651+ return item ? item->_srcColumn : 0;
11652+ }
11653+ inline Value &
11654+ Value::setSourceLine(int line)
11655+ {
11656+ detail::ValueItem *item = this->item();
11657+ if (item)
11658+ item->_srcLine = line;
11659+ return *this;
11660+ }
11661+ inline Value &
11662+ Value::setSourceColumn(int col)
11663+ {
11664+ detail::ValueItem *item = this->item();
11665+ if (item)
11666+ item->_srcColumn = col;
11667+ return *this;
11668+ }
11669+ inline Value &
11670+ Value::setSource(int line, int col)
11671+ {
11672+ detail::ValueItem *item = this->item();
11673+ if (item) {
11674+ item->_srcLine = line;
11675+ item->_srcColumn = col;
11676+ }
11677+ return *this;
11678+ }
11679
11680- These methods will fail if
11681- - @c this is not a container.
11682- - @c this is a @c Group and no @a name is provided.
11683+ inline Path::ImplType::ImplType() {}
11684
11685- @note Currently for groups, duplicate names are not
11686- detected. The duplicates will be inaccessible by name but can
11687- still be found by index. This is a problem but I am still
11688- pondering the appropriate solution.
11689+ inline Path::Path() {}
11690+ inline Path::ImplType *
11691+ Path::instance()
11692+ {
11693+ if (!_ptr)
11694+ _ptr.reset(new ImplType);
11695+ return _ptr.get();
11696+ }
11697+ inline Path &
11698+ Path::append(ConstBuffer const &tag)
11699+ {
11700+ this->instance()->_elements.push_back(tag);
11701+ return *this;
11702+ }
11703+ inline Path &
11704+ Path::append(size_t index)
11705+ {
11706+ this->instance()->_elements.push_back(ConstBuffer(nullptr, index));
11707+ return *this;
11708+ }
11709+ inline size_t
11710+ Path::count() const
11711+ {
11712+ return _ptr ? _ptr->_elements.size() : 0;
11713+ }
11714+ inline ConstBuffer const &Path::operator[](size_t idx) const { return _ptr ? _ptr->_elements[idx] : detail::NULL_CONST_BUFFER; }
11715+
11716+ inline Path::Parser::Parser() {}
11717+ inline Path::Parser::Parser(ConstBuffer const &text) : _input(text), _c(text._ptr) {}
11718+ inline bool
11719+ Path::Parser::hasInput() const
11720+ {
11721+ return _input._ptr && _input._ptr + _input._size > _c;
11722+ }
11723
11724- @see isContainer
11725- @return The new value, or an invalid value plus errata on failure.
11726+ inline bool Configuration::operator!() const { return !_table; }
11727+ inline Configuration::operator detail::PseudoBool::Type() const { return _table.operator detail::PseudoBool::Type(); }
11728+ inline Value
11729+ Configuration::find(char const *path)
11730+ {
11731+ return this->getRoot().find(path);
11732+ }
11733+ inline Buffer
11734+ Configuration::alloc(size_t n)
11735+ {
11736+ return _table.alloc(n);
11737+ }
11738+ inline size_t
11739+ Configuration::childCount() const
11740+ {
11741+ return this->getRoot().childCount();
11742+ }
11743+ inline Value Configuration::operator[](size_t idx) const { return (this->getRoot())[idx]; }
11744+ inline Value Configuration::operator[](ConstBuffer const &name) const { return (this->getRoot())[name]; }
11745+ inline Value Configuration::operator[](char const *name) const { return (this->getRoot())[name]; }
11746
11747- @internal I original had this as a single method, but changed to
11748- separate per type. Overall less ugly because we can get the
11749- arguments more useful.
11750- */
11751- //@{
11752- /// Create a @c String value.
11753- Rv<Value> makeString(
11754- ConstBuffer const& text, ///< String content.
11755- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
11756- );
11757- /// Create an @c Integer value.
11758- Rv<Value> makeInteger(
11759- ConstBuffer const& text, ///< Text of number.
11760- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
11761- );
11762- /// Create a @c Group value.
11763- Rv<Value> makeGroup(
11764- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
11765- );
11766- /// Create a @c List value.
11767- Rv<Value> makeList(
11768- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
11769- );
11770- /// Create a @c Path value.
11771- Rv<Value> makePath(
11772- Path const& path, ///< Path.
11773- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
11774- );
11775- /// Create a child by type.
11776- /// Client must fill in any other required elements.
11777- Rv<Value> makeChild(
11778- ValueType type, ///< Type of child.
11779- ConstBuffer const& name = detail::NULL_BUFFER///< Optional name of value.
11780- );
11781- //@}
11782-
11783- /** Find a value.
11784- @return The value if found, an void valid if not.
11785- */
11786- Value find(
11787- ConstBuffer const& path ///< Path relative to this value.
11788- );
11789- /** Find a value.
11790- @return The value if found, an void valid if not.
11791- */
11792- Value find(
11793- char const* path ///< Path relative to this value.
11794- );
11795- /** Find a value using a precondensed path.
11796- @return The value if found, an void valid if not.
11797- */
11798- Value find(
11799- Path const& path ///< Path relative to this value.
11800- );
11801+} // namespace config
11802+} // namespace ts
11803
11804- /** Reset to default constructed state.
11805- @note This wrapper is reset, the value in the configuration is unchanged.
11806- @return @c this object.
11807- */
11808- self& reset();
11809-
11810- /// Set source line.
11811- /// @return @c this object.
11812- self& setSourceLine(
11813- int line ///< Line in source stream.
11814- );
11815- /// Set source column.
11816- /// @return @c this object.
11817- self& setSourceColumn(
11818- int col ///< Column in source stream.
11819- );
11820- /// Set the source location.
11821- self& setSource(
11822- int line, ///< Line in source stream.
11823- int col ///< Column in source stream.
11824- );
11825- /// Get source line.
11826- /// @return The line in the source stream for this value.
11827- int getSourceLine() const;
11828- /// Get source column.
11829- /// @return The column in the source stream for this value.
11830- int getSourceColumn() const;
11831-
11832-protected:
11833- // Note: We store an index and not a pointer because a pointer will go stale
11834- // if any items are added or removed from the underlying table.
11835- // Also, by storing the configuration, we hold it in memory as long as a Value
11836- // is in client hands.
11837- Configuration _config; ///< The configuration for this value.
11838- detail::ValueIndex _vidx; ///< Index of item.
11839-
11840- static Buffer const NULL_BUFFER; ///< Empty buffer to return on method failures.
11841-
11842- /// Construct from raw data.
11843- Value(
11844- Configuration cfg, ///< Source configuration.
11845- detail::ValueIndex vidx ///< Index of value.
11846- );
11847-
11848- /** Get raw item pointer.
11849- @note This pointer is unstable and must be recomputed on each method invocation.
11850- @return The item pointer or @c NULL if this value is invalid.
11851- */
11852- detail::ValueItem* item();
11853- /** Get constant raw item pointer.
11854- @note This pointer is unstable and must be recomputed on each method invocation.
11855- @return The item pointer or @c NULL if this value is invalid.
11856- */
11857- detail::ValueItem const* item() const;
11858-};
11859-
11860-// Inline methods.
11861-namespace detail {
11862- inline bool ValueTable::operator ! () const { return ! _ptr; }
11863- inline ValueTable::operator PseudoBool::Type () const { return _ptr ? PseudoBool::TRUE : PseudoBool::FALSE; }
11864- inline size_t ValueTable::size() const { return _ptr ? _ptr->_values.size() : 0; }
11865- inline Generation ValueTable::generation() const { return _ptr ? _ptr->_generation : Generation(0); }
11866- inline ValueItem const& ValueTable::operator [] (ValueIndex idx) const { return const_cast<self*>(this)->operator [] (idx); }
11867- inline ValueTable& ValueTable::reset() { _ptr.reset(); return *this; }
11868-
11869- inline ValueItem::ValueItem() {}
11870- inline ValueItem::ValueItem(ValueType type) : _type(type) {}
11871- inline ValueType ValueItem::getType() const { return _type; }
11872-}
11873-
11874-inline Value::~Value() { }
11875-inline Value::Value() : _vidx(detail::NULL_VALUE_INDEX) {}
11876-inline Value::Value(Configuration cfg, detail::ValueIndex vidx) : _config(std::move(cfg)), _vidx(vidx) { }
11877-inline bool Value::hasValue() const { return _config && _vidx != detail::NULL_VALUE_INDEX; }
11878-inline Value::operator detail::PseudoBool::Type () const { return this->hasValue() ? detail::PseudoBool::TRUE : detail::PseudoBool::FALSE; }
11879-inline bool Value::operator ! () const { return ! this->hasValue(); }
11880-inline ValueType Value::getType() const { return this->hasValue() ? _config._table[_vidx]._type : VoidValue; }
11881-inline ConstBuffer const& Value::getText() const {
11882- return this->hasValue() ? _config._table[_vidx]._text : detail::NULL_CONST_BUFFER;
11883-}
11884-inline Value& Value::setText(ConstBuffer const& text) {
11885- detail::ValueItem* item = this->item();
11886- if (item) item->_text = text;
11887- return *this;
11888-}
11889-inline ConstBuffer const& Value::getName() const {
11890- detail::ValueItem const* item = this->item();
11891- return item ? item->_name : detail::NULL_CONST_BUFFER;
11892-}
11893-inline size_t Value::getIndex() const {
11894- detail::ValueItem const* item = this->item();
11895- return item ? item->_local_index : 0;
11896-}
11897-
11898-inline bool Value::isLiteral() const { return 0 != (detail::IS_LITERAL & detail::Type_Property[this->getType()]); }
11899-inline bool Value::isContainer() const { return 0 != (detail::IS_CONTAINER & detail::Type_Property[this->getType()]); }
11900-inline Value Value::getParent() const { return this->hasValue() ? Value(_config, _config._table[_vidx]._parent) : Value(); }
11901-inline bool Value::isRoot() const { return this->hasValue() && _vidx == 0; }
11902-inline Value& Value::reset() { _config = Configuration(); _vidx = detail::NULL_VALUE_INDEX; return *this; }
11903-inline detail::ValueItem* Value::item() { return this->hasValue() ? &(_config._table[_vidx]) : nullptr; }
11904-inline detail::ValueItem const* Value::item() const { return const_cast<self*>(this)->item(); }
11905-inline Value Value::operator [] (char const* name) const { return (*this)[ConstBuffer(name, strlen(name))]; }
11906-inline size_t Value::childCount() const {
11907- detail::ValueItem const* item = this->item();
11908- return item ? item->_children.size() : 0;
11909-}
11910-inline Value Value::find(char const* path) { return this->find(ConstBuffer(path, strlen(path))); }
11911-inline int Value::getSourceLine() const {
11912- detail::ValueItem const* item = this->item();
11913- return item ? item->_srcLine : 0;
11914-}
11915-inline int Value::getSourceColumn() const {
11916- detail::ValueItem const* item = this->item();
11917- return item ? item->_srcColumn : 0;
11918-}
11919-inline Value& Value::setSourceLine(int line) {
11920- detail::ValueItem* item = this->item();
11921- if (item) item->_srcLine = line;
11922- return *this;
11923-}
11924-inline Value& Value::setSourceColumn(int col) {
11925- detail::ValueItem* item = this->item();
11926- if (item) item->_srcColumn = col;
11927- return *this;
11928-}
11929-inline Value& Value::setSource(int line, int col) {
11930- detail::ValueItem* item = this->item();
11931- if (item) {
11932- item->_srcLine = line;
11933- item->_srcColumn = col;
11934- }
11935- return *this;
11936-}
11937-
11938-inline Path::ImplType::ImplType() { }
11939-
11940-inline Path::Path() { }
11941-inline Path::ImplType* Path::instance() { if (!_ptr) _ptr.reset(new ImplType); return _ptr.get(); }
11942-inline Path& Path::append(ConstBuffer const& tag) { this->instance()->_elements.push_back(tag); return *this; }
11943-inline Path& Path::append(size_t index) { this->instance()->_elements.push_back(ConstBuffer(nullptr, index)); return *this; }
11944-inline size_t Path::count() const { return _ptr ? _ptr->_elements.size() : 0; }
11945-inline ConstBuffer const& Path::operator [] (size_t idx) const { return _ptr ? _ptr->_elements[idx] : detail::NULL_CONST_BUFFER; }
11946-
11947-inline Path::Parser::Parser() { }
11948-inline Path::Parser::Parser( ConstBuffer const& text ) : _input(text), _c(text._ptr) { }
11949-inline bool Path::Parser::hasInput() const { return _input._ptr && _input._ptr + _input._size > _c; }
11950-
11951-inline bool Configuration::operator ! () const { return ! _table; }
11952-inline Configuration::operator detail::PseudoBool::Type() const { return _table.operator detail::PseudoBool::Type(); }
11953-inline Value Configuration::find( char const* path ) { return this->getRoot().find(path); }
11954-inline Buffer Configuration::alloc(size_t n) { return _table.alloc(n); }
11955-inline size_t Configuration::childCount() const { return this->getRoot().childCount(); }
11956-inline Value Configuration::operator [] (size_t idx) const { return (this->getRoot())[idx]; }
11957-inline Value Configuration::operator [] ( ConstBuffer const& name ) const { return (this->getRoot())[name]; }
11958-inline Value Configuration::operator [] ( char const* name ) const { return (this->getRoot())[name]; }
11959-
11960-}} // namespace ts::config
11961-
11962-# endif
11963+#endif
11964diff --git a/lib/tsconfig/test-tsconfig.cc b/lib/tsconfig/test-tsconfig.cc
11965index 41bbf024b..433245ddd 100644
11966--- a/lib/tsconfig/test-tsconfig.cc
11967+++ b/lib/tsconfig/test-tsconfig.cc
11968@@ -18,21 +18,27 @@
11969 limitations under the License.
11970 */
11971
11972-# include "tsconfig/TsValue.h"
11973-# include <cstdio>
11974-# include <iostream>
11975+#include "tsconfig/TsValue.h"
11976+#include <cstdio>
11977+#include <iostream>
11978
11979 using ts::config::Configuration;
11980 using ts::config::Value;
11981
11982-inline std::ostream& operator << ( std::ostream& s, ts::ConstBuffer const& b ) {
11983- if (b._ptr) { s.write(b._ptr, b._size);
11984- } else { s << b._size;
11985-}
11986+inline std::ostream &
11987+operator<<(std::ostream &s, ts::ConstBuffer const &b)
11988+{
11989+ if (b._ptr) {
11990+ s.write(b._ptr, b._size);
11991+ } else {
11992+ s << b._size;
11993+ }
11994 return s;
11995 }
11996
11997-int main(int /* argc ATS_UNUSED */, char **/* argv ATS_UNUSED */) {
11998+int
11999+main(int /* argc ATS_UNUSED */, char ** /* argv ATS_UNUSED */)
12000+{
12001 printf("Testing TsConfig\n");
12002 ts::Rv<Configuration> cv = Configuration::loadFromPath("test-1.tsconfig");
12003 if (cv.isOK()) {
12004@@ -43,8 +49,6 @@ int main(int /* argc ATS_UNUSED */, char **/* argv ATS_UNUSED */) {
12005 std::cout << "Failed to find 'name' in 'thing-1'" << std::endl;
12006 }
12007 } else {
12008- std::cout << "Load failed" << std::endl
12009- << cv.errata()
12010- ;
12011+ std::cout << "Load failed" << std::endl << cv.errata();
12012 }
12013 }
12014diff --git a/lib/yamlcpp/include/yaml-cpp/anchor.h b/lib/yamlcpp/include/yaml-cpp/anchor.h
12015index 06759c724..f947580af 100644
12016--- a/lib/yamlcpp/include/yaml-cpp/anchor.h
12017+++ b/lib/yamlcpp/include/yaml-cpp/anchor.h
12018@@ -12,6 +12,6 @@
12019 namespace YAML {
12020 typedef std::size_t anchor_t;
12021 const anchor_t NullAnchor = 0;
12022-}
12023+} // namespace YAML
12024
12025 #endif // ANCHOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12026diff --git a/lib/yamlcpp/include/yaml-cpp/binary.h b/lib/yamlcpp/include/yaml-cpp/binary.h
12027index 29d5dbd02..024157096 100644
12028--- a/lib/yamlcpp/include/yaml-cpp/binary.h
12029+++ b/lib/yamlcpp/include/yaml-cpp/binary.h
12030@@ -62,6 +62,6 @@ class YAML_CPP_API Binary {
12031 const unsigned char *m_unownedData;
12032 std::size_t m_unownedSize;
12033 };
12034-}
12035+} // namespace YAML
12036
12037 #endif // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12038diff --git a/lib/yamlcpp/include/yaml-cpp/contrib/anchordict.h b/lib/yamlcpp/include/yaml-cpp/contrib/anchordict.h
12039index 78db9ec92..0c2f63a87 100644
12040--- a/lib/yamlcpp/include/yaml-cpp/contrib/anchordict.h
12041+++ b/lib/yamlcpp/include/yaml-cpp/contrib/anchordict.h
12042@@ -34,6 +34,6 @@ class AnchorDict {
12043 private:
12044 std::vector<T> m_data;
12045 };
12046-}
12047+} // namespace YAML
12048
12049 #endif // ANCHORDICT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12050diff --git a/lib/yamlcpp/include/yaml-cpp/contrib/graphbuilder.h b/lib/yamlcpp/include/yaml-cpp/contrib/graphbuilder.h
12051index f0a38f288..98500ea3f 100644
12052--- a/lib/yamlcpp/include/yaml-cpp/contrib/graphbuilder.h
12053+++ b/lib/yamlcpp/include/yaml-cpp/contrib/graphbuilder.h
12054@@ -144,6 +144,6 @@ typename Impl::Node *BuildGraphOfNextDocument(Parser &parser, Impl &impl) {
12055 return static_cast<typename Impl::Node *>(
12056 BuildGraphOfNextDocument(parser, graphBuilder));
12057 }
12058-}
12059+} // namespace YAML
12060
12061 #endif // GRAPHBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12062diff --git a/lib/yamlcpp/include/yaml-cpp/emitfromevents.h b/lib/yamlcpp/include/yaml-cpp/emitfromevents.h
12063index f14b051ab..f5c132bd7 100644
12064--- a/lib/yamlcpp/include/yaml-cpp/emitfromevents.h
12065+++ b/lib/yamlcpp/include/yaml-cpp/emitfromevents.h
12066@@ -52,6 +52,6 @@ class EmitFromEvents : public EventHandler {
12067 };
12068 std::stack<State::value> m_stateStack;
12069 };
12070-}
12071+} // namespace YAML
12072
12073 #endif // EMITFROMEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12074diff --git a/lib/yamlcpp/include/yaml-cpp/emitter.h b/lib/yamlcpp/include/yaml-cpp/emitter.h
12075index ef92cc403..21b03d03f 100644
12076--- a/lib/yamlcpp/include/yaml-cpp/emitter.h
12077+++ b/lib/yamlcpp/include/yaml-cpp/emitter.h
12078@@ -249,6 +249,6 @@ inline Emitter& operator<<(Emitter& emitter, _Indent indent) {
12079 inline Emitter& operator<<(Emitter& emitter, _Precision precision) {
12080 return emitter.SetLocalPrecision(precision);
12081 }
12082-}
12083+} // namespace YAML
12084
12085 #endif // EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12086diff --git a/lib/yamlcpp/include/yaml-cpp/emitterdef.h b/lib/yamlcpp/include/yaml-cpp/emitterdef.h
12087index 0b426957f..29230fe7a 100644
12088--- a/lib/yamlcpp/include/yaml-cpp/emitterdef.h
12089+++ b/lib/yamlcpp/include/yaml-cpp/emitterdef.h
12090@@ -11,6 +11,6 @@ namespace YAML {
12091 struct EmitterNodeType {
12092 enum value { NoType, Property, Scalar, FlowSeq, BlockSeq, FlowMap, BlockMap };
12093 };
12094-}
12095+} // namespace YAML
12096
12097 #endif // EMITTERDEF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12098diff --git a/lib/yamlcpp/include/yaml-cpp/emittermanip.h b/lib/yamlcpp/include/yaml-cpp/emittermanip.h
12099index 89f725671..8f1ce8b74 100644
12100--- a/lib/yamlcpp/include/yaml-cpp/emittermanip.h
12101+++ b/lib/yamlcpp/include/yaml-cpp/emittermanip.h
12102@@ -132,6 +132,6 @@ inline _Precision FloatPrecision(int n) { return _Precision(n, -1); }
12103 inline _Precision DoublePrecision(int n) { return _Precision(-1, n); }
12104
12105 inline _Precision Precision(int n) { return _Precision(n, n); }
12106-}
12107+} // namespace YAML
12108
12109 #endif // EMITTERMANIP_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12110diff --git a/lib/yamlcpp/include/yaml-cpp/emitterstyle.h b/lib/yamlcpp/include/yaml-cpp/emitterstyle.h
12111index 67bb3981b..2ae40324f 100644
12112--- a/lib/yamlcpp/include/yaml-cpp/emitterstyle.h
12113+++ b/lib/yamlcpp/include/yaml-cpp/emitterstyle.h
12114@@ -11,6 +11,6 @@ namespace YAML {
12115 struct EmitterStyle {
12116 enum value { Default, Block, Flow };
12117 };
12118-}
12119+} // namespace YAML
12120
12121 #endif // EMITTERSTYLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12122diff --git a/lib/yamlcpp/include/yaml-cpp/eventhandler.h b/lib/yamlcpp/include/yaml-cpp/eventhandler.h
12123index efe381c62..8a024feb4 100644
12124--- a/lib/yamlcpp/include/yaml-cpp/eventhandler.h
12125+++ b/lib/yamlcpp/include/yaml-cpp/eventhandler.h
12126@@ -35,6 +35,6 @@ class EventHandler {
12127 anchor_t anchor, EmitterStyle::value style) = 0;
12128 virtual void OnMapEnd() = 0;
12129 };
12130-}
12131+} // namespace YAML
12132
12133 #endif // EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12134diff --git a/lib/yamlcpp/include/yaml-cpp/exceptions.h b/lib/yamlcpp/include/yaml-cpp/exceptions.h
12135index 9c96859b2..c88d051f3 100644
12136--- a/lib/yamlcpp/include/yaml-cpp/exceptions.h
12137+++ b/lib/yamlcpp/include/yaml-cpp/exceptions.h
12138@@ -16,9 +16,9 @@
12139 // This is here for compatibility with older versions of Visual Studio
12140 // which don't support noexcept
12141 #ifdef _MSC_VER
12142- #define YAML_CPP_NOEXCEPT _NOEXCEPT
12143+#define YAML_CPP_NOEXCEPT _NOEXCEPT
12144 #else
12145- #define YAML_CPP_NOEXCEPT noexcept
12146+#define YAML_CPP_NOEXCEPT noexcept
12147 #endif
12148
12149 namespace YAML {
12150@@ -114,7 +114,7 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(
12151 stream << KEY_NOT_FOUND << ": " << key;
12152 return stream.str();
12153 }
12154-}
12155+} // namespace ErrorMsg
12156
12157 class YAML_CPP_API Exception : public std::runtime_error {
12158 public:
12159@@ -260,7 +260,7 @@ class YAML_CPP_API BadFile : public Exception {
12160 BadFile(const BadFile&) = default;
12161 virtual ~BadFile() YAML_CPP_NOEXCEPT;
12162 };
12163-}
12164+} // namespace YAML
12165
12166 #undef YAML_CPP_NOEXCEPT
12167
12168diff --git a/lib/yamlcpp/include/yaml-cpp/mark.h b/lib/yamlcpp/include/yaml-cpp/mark.h
12169index bf94b4f41..8c5999595 100644
12170--- a/lib/yamlcpp/include/yaml-cpp/mark.h
12171+++ b/lib/yamlcpp/include/yaml-cpp/mark.h
12172@@ -24,6 +24,6 @@ struct YAML_CPP_API Mark {
12173 Mark(int pos_, int line_, int column_)
12174 : pos(pos_), line(line_), column(column_) {}
12175 };
12176-}
12177+} // namespace YAML
12178
12179 #endif // MARK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12180diff --git a/lib/yamlcpp/include/yaml-cpp/node/convert.h b/lib/yamlcpp/include/yaml-cpp/node/convert.h
12181index 45a878ab0..87d976bd8 100644
12182--- a/lib/yamlcpp/include/yaml-cpp/node/convert.h
12183+++ b/lib/yamlcpp/include/yaml-cpp/node/convert.h
12184@@ -42,7 +42,7 @@ inline bool IsNegativeInfinity(const std::string& input) {
12185 inline bool IsNaN(const std::string& input) {
12186 return input == ".nan" || input == ".NaN" || input == ".NAN";
12187 }
12188-}
12189+} // namespace conversion
12190
12191 // Node
12192 template <>
12193@@ -76,7 +76,7 @@ struct convert<const char*> {
12194
12195 template <std::size_t N>
12196 struct convert<const char[N]> {
12197- static Node encode(const char(&rhs)[N]) { return Node(rhs); }
12198+ static Node encode(const char (&rhs)[N]) { return Node(rhs); }
12199 };
12200
12201 template <>
12202@@ -326,6 +326,6 @@ struct convert<Binary> {
12203 return true;
12204 }
12205 };
12206-}
12207+} // namespace YAML
12208
12209 #endif // NODE_CONVERT_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12210diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/bool_type.h b/lib/yamlcpp/include/yaml-cpp/node/detail/bool_type.h
12211index 2c80705c9..38b631aa3 100644
12212--- a/lib/yamlcpp/include/yaml-cpp/node/detail/bool_type.h
12213+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/bool_type.h
12214@@ -14,8 +14,8 @@ struct unspecified_bool {
12215 static void true_value(NOT_ALLOWED*) {}
12216 };
12217 typedef void (*unspecified_bool_type)(unspecified_bool::NOT_ALLOWED*);
12218-}
12219-}
12220+} // namespace detail
12221+} // namespace YAML
12222
12223 #define YAML_CPP_OPERATOR_BOOL() \
12224 operator YAML::detail::unspecified_bool_type() const { \
12225diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/impl.h b/lib/yamlcpp/include/yaml-cpp/node/detail/impl.h
12226index 09e55f838..908badc2c 100644
12227--- a/lib/yamlcpp/include/yaml-cpp/node/detail/impl.h
12228+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/impl.h
12229@@ -32,7 +32,7 @@ struct get_idx<Key,
12230
12231 static node* get(std::vector<node*>& sequence, const Key& key,
12232 shared_memory_holder pMemory) {
12233- if (key > sequence.size() || (key > 0 && !sequence[key-1]->is_defined()))
12234+ if (key > sequence.size() || (key > 0 && !sequence[key - 1]->is_defined()))
12235 return 0;
12236 if (key == sequence.size())
12237 sequence.push_back(&pMemory->create_node());
12238@@ -179,7 +179,7 @@ inline node& node_data::convert_to_node(const T& rhs,
12239 pMemory->merge(*value.m_pMemory);
12240 return *value.m_pNode;
12241 }
12242-}
12243-}
12244+} // namespace detail
12245+} // namespace YAML
12246
12247 #endif // NODE_DETAIL_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12248diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/iterator.h b/lib/yamlcpp/include/yaml-cpp/node/detail/iterator.h
12249index deec8fb62..88d986b39 100644
12250--- a/lib/yamlcpp/include/yaml-cpp/node/detail/iterator.h
12251+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/iterator.h
12252@@ -8,9 +8,9 @@
12253 #endif
12254
12255 #include "yaml-cpp/dll.h"
12256+#include "yaml-cpp/node/detail/node_iterator.h"
12257 #include "yaml-cpp/node/node.h"
12258 #include "yaml-cpp/node/ptr.h"
12259-#include "yaml-cpp/node/detail/node_iterator.h"
12260 #include <cstddef>
12261 #include <iterator>
12262
12263@@ -86,7 +86,7 @@ class iterator_base : public std::iterator<std::forward_iterator_tag, V,
12264 base_type m_iterator;
12265 shared_memory_holder m_pMemory;
12266 };
12267-}
12268-}
12269+} // namespace detail
12270+} // namespace YAML
12271
12272 #endif // VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12273diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/iterator_fwd.h b/lib/yamlcpp/include/yaml-cpp/node/detail/iterator_fwd.h
12274index 5f1ffe743..963ed5030 100644
12275--- a/lib/yamlcpp/include/yaml-cpp/node/detail/iterator_fwd.h
12276+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/iterator_fwd.h
12277@@ -18,10 +18,10 @@ namespace detail {
12278 struct iterator_value;
12279 template <typename V>
12280 class iterator_base;
12281-}
12282+} // namespace detail
12283
12284 typedef detail::iterator_base<detail::iterator_value> iterator;
12285 typedef detail::iterator_base<const detail::iterator_value> const_iterator;
12286-}
12287+} // namespace YAML
12288
12289 #endif // VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12290diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/memory.h b/lib/yamlcpp/include/yaml-cpp/node/detail/memory.h
12291index 8f2bc2657..99d5d0031 100644
12292--- a/lib/yamlcpp/include/yaml-cpp/node/detail/memory.h
12293+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/memory.h
12294@@ -40,7 +40,7 @@ class YAML_CPP_API memory_holder {
12295 private:
12296 shared_memory m_pMemory;
12297 };
12298-}
12299-}
12300+} // namespace detail
12301+} // namespace YAML
12302
12303 #endif // VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12304diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/node.h b/lib/yamlcpp/include/yaml-cpp/node/detail/node.h
12305index 8a776f62a..41415df95 100644
12306--- a/lib/yamlcpp/include/yaml-cpp/node/detail/node.h
12307+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/node.h
12308@@ -7,11 +7,11 @@
12309 #pragma once
12310 #endif
12311
12312-#include "yaml-cpp/emitterstyle.h"
12313 #include "yaml-cpp/dll.h"
12314-#include "yaml-cpp/node/type.h"
12315-#include "yaml-cpp/node/ptr.h"
12316+#include "yaml-cpp/emitterstyle.h"
12317 #include "yaml-cpp/node/detail/node_ref.h"
12318+#include "yaml-cpp/node/ptr.h"
12319+#include "yaml-cpp/node/type.h"
12320 #include <set>
12321
12322 namespace YAML {
12323@@ -163,7 +163,7 @@ class node {
12324 typedef std::set<node*> nodes;
12325 nodes m_dependencies;
12326 };
12327-}
12328-}
12329+} // namespace detail
12330+} // namespace YAML
12331
12332 #endif // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12333diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/node_data.h b/lib/yamlcpp/include/yaml-cpp/node/detail/node_data.h
12334index 50bcd7435..fed3ffef1 100644
12335--- a/lib/yamlcpp/include/yaml-cpp/node/detail/node_data.h
12336+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/node_data.h
12337@@ -121,7 +121,7 @@ class YAML_CPP_API node_data {
12338 typedef std::list<kv_pair> kv_pairs;
12339 mutable kv_pairs m_undefinedPairs;
12340 };
12341-}
12342-}
12343+} // namespace detail
12344+} // namespace YAML
12345
12346 #endif // VALUE_DETAIL_NODE_DATA_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12347diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/node_iterator.h b/lib/yamlcpp/include/yaml-cpp/node/detail/node_iterator.h
12348index 088090fe7..cdecd9565 100644
12349--- a/lib/yamlcpp/include/yaml-cpp/node/detail/node_iterator.h
12350+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/node_iterator.h
12351@@ -11,8 +11,8 @@
12352 #include "yaml-cpp/node/ptr.h"
12353 #include <cstddef>
12354 #include <iterator>
12355-#include <memory>
12356 #include <map>
12357+#include <memory>
12358 #include <utility>
12359 #include <vector>
12360
12361@@ -174,7 +174,7 @@ class node_iterator_base
12362
12363 typedef node_iterator_base<node> node_iterator;
12364 typedef node_iterator_base<const node> const_node_iterator;
12365-}
12366-}
12367+} // namespace detail
12368+} // namespace YAML
12369
12370 #endif // VALUE_DETAIL_NODE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12371diff --git a/lib/yamlcpp/include/yaml-cpp/node/detail/node_ref.h b/lib/yamlcpp/include/yaml-cpp/node/detail/node_ref.h
12372index d8a94f8b8..04fa26af1 100644
12373--- a/lib/yamlcpp/include/yaml-cpp/node/detail/node_ref.h
12374+++ b/lib/yamlcpp/include/yaml-cpp/node/detail/node_ref.h
12375@@ -8,9 +8,9 @@
12376 #endif
12377
12378 #include "yaml-cpp/dll.h"
12379-#include "yaml-cpp/node/type.h"
12380-#include "yaml-cpp/node/ptr.h"
12381 #include "yaml-cpp/node/detail/node_data.h"
12382+#include "yaml-cpp/node/ptr.h"
12383+#include "yaml-cpp/node/type.h"
12384
12385 namespace YAML {
12386 namespace detail {
12387@@ -92,7 +92,7 @@ class node_ref {
12388 private:
12389 shared_node_data m_pData;
12390 };
12391-}
12392-}
12393+} // namespace detail
12394+} // namespace YAML
12395
12396 #endif // VALUE_DETAIL_NODE_REF_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12397diff --git a/lib/yamlcpp/include/yaml-cpp/node/emit.h b/lib/yamlcpp/include/yaml-cpp/node/emit.h
12398index 032268c5d..43bdbdaa0 100644
12399--- a/lib/yamlcpp/include/yaml-cpp/node/emit.h
12400+++ b/lib/yamlcpp/include/yaml-cpp/node/emit.h
12401@@ -7,8 +7,8 @@
12402 #pragma once
12403 #endif
12404
12405-#include <string>
12406 #include <iosfwd>
12407+#include <string>
12408
12409 #include "yaml-cpp/dll.h"
12410
12411diff --git a/lib/yamlcpp/include/yaml-cpp/node/impl.h b/lib/yamlcpp/include/yaml-cpp/node/impl.h
12412index 20c487a68..ea2a1f5f3 100644
12413--- a/lib/yamlcpp/include/yaml-cpp/node/impl.h
12414+++ b/lib/yamlcpp/include/yaml-cpp/node/impl.h
12415@@ -7,11 +7,11 @@
12416 #pragma once
12417 #endif
12418
12419-#include "yaml-cpp/node/node.h"
12420-#include "yaml-cpp/node/iterator.h"
12421+#include "yaml-cpp/exceptions.h"
12422 #include "yaml-cpp/node/detail/memory.h"
12423 #include "yaml-cpp/node/detail/node.h"
12424-#include "yaml-cpp/exceptions.h"
12425+#include "yaml-cpp/node/iterator.h"
12426+#include "yaml-cpp/node/node.h"
12427 #include <string>
12428
12429 namespace YAML {
12430@@ -366,7 +366,7 @@ template <typename T>
12431 inline typename to_value_t<T>::return_type to_value(const T& t) {
12432 return to_value_t<T>(t)();
12433 }
12434-}
12435+} // namespace detail
12436
12437 // indexing
12438 template <typename Key>
12439@@ -374,8 +374,8 @@ inline const Node Node::operator[](const Key& key) const {
12440 if (!m_isValid)
12441 throw InvalidNode();
12442 EnsureNodeExists();
12443- detail::node* value = static_cast<const detail::node&>(*m_pNode)
12444- .get(detail::to_value(key), m_pMemory);
12445+ detail::node* value = static_cast<const detail::node&>(*m_pNode).get(
12446+ detail::to_value(key), m_pMemory);
12447 if (!value) {
12448 return Node(ZombieNode);
12449 }
12450@@ -443,6 +443,6 @@ inline void Node::force_insert(const Key& key, const Value& value) {
12451
12452 // free functions
12453 inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); }
12454-}
12455+} // namespace YAML
12456
12457 #endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12458diff --git a/lib/yamlcpp/include/yaml-cpp/node/iterator.h b/lib/yamlcpp/include/yaml-cpp/node/iterator.h
12459index 366a9c807..fb8ce5ff0 100644
12460--- a/lib/yamlcpp/include/yaml-cpp/node/iterator.h
12461+++ b/lib/yamlcpp/include/yaml-cpp/node/iterator.h
12462@@ -8,9 +8,9 @@
12463 #endif
12464
12465 #include "yaml-cpp/dll.h"
12466-#include "yaml-cpp/node/node.h"
12467-#include "yaml-cpp/node/detail/iterator_fwd.h"
12468 #include "yaml-cpp/node/detail/iterator.h"
12469+#include "yaml-cpp/node/detail/iterator_fwd.h"
12470+#include "yaml-cpp/node/node.h"
12471 #include <list>
12472 #include <utility>
12473 #include <vector>
12474@@ -25,7 +25,7 @@ struct iterator_value : public Node, std::pair<Node, Node> {
12475 explicit iterator_value(const Node& key, const Node& value)
12476 : Node(Node::ZombieNode), std::pair<Node, Node>(key, value) {}
12477 };
12478-}
12479-}
12480+} // namespace detail
12481+} // namespace YAML
12482
12483 #endif // VALUE_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12484diff --git a/lib/yamlcpp/include/yaml-cpp/node/node.h b/lib/yamlcpp/include/yaml-cpp/node/node.h
12485index 1ded7d27b..41fc3b19e 100644
12486--- a/lib/yamlcpp/include/yaml-cpp/node/node.h
12487+++ b/lib/yamlcpp/include/yaml-cpp/node/node.h
12488@@ -140,6 +140,6 @@ YAML_CPP_API Node Clone(const Node& node);
12489
12490 template <typename T>
12491 struct convert;
12492-}
12493+} // namespace YAML
12494
12495 #endif // NODE_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12496diff --git a/lib/yamlcpp/include/yaml-cpp/node/ptr.h b/lib/yamlcpp/include/yaml-cpp/node/ptr.h
12497index ce085dd5c..b1bc53241 100644
12498--- a/lib/yamlcpp/include/yaml-cpp/node/ptr.h
12499+++ b/lib/yamlcpp/include/yaml-cpp/node/ptr.h
12500@@ -23,7 +23,7 @@ typedef std::shared_ptr<node_ref> shared_node_ref;
12501 typedef std::shared_ptr<node_data> shared_node_data;
12502 typedef std::shared_ptr<memory_holder> shared_memory_holder;
12503 typedef std::shared_ptr<memory> shared_memory;
12504-}
12505-}
12506+} // namespace detail
12507+} // namespace YAML
12508
12509 #endif // VALUE_PTR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12510diff --git a/lib/yamlcpp/include/yaml-cpp/node/type.h b/lib/yamlcpp/include/yaml-cpp/node/type.h
12511index 9d55ca966..900bbdd9d 100644
12512--- a/lib/yamlcpp/include/yaml-cpp/node/type.h
12513+++ b/lib/yamlcpp/include/yaml-cpp/node/type.h
12514@@ -11,6 +11,6 @@ namespace YAML {
12515 struct NodeType {
12516 enum value { Undefined, Null, Scalar, Sequence, Map };
12517 };
12518-}
12519+} // namespace YAML
12520
12521 #endif // VALUE_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12522diff --git a/lib/yamlcpp/include/yaml-cpp/noncopyable.h b/lib/yamlcpp/include/yaml-cpp/noncopyable.h
12523index a26104073..a1c2d992a 100644
12524--- a/lib/yamlcpp/include/yaml-cpp/noncopyable.h
12525+++ b/lib/yamlcpp/include/yaml-cpp/noncopyable.h
12526@@ -20,6 +20,6 @@ class YAML_CPP_API noncopyable {
12527 noncopyable(const noncopyable&);
12528 const noncopyable& operator=(const noncopyable&);
12529 };
12530-}
12531+} // namespace YAML
12532
12533 #endif // NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12534diff --git a/lib/yamlcpp/include/yaml-cpp/null.h b/lib/yamlcpp/include/yaml-cpp/null.h
12535index b9521d488..86167edab 100644
12536--- a/lib/yamlcpp/include/yaml-cpp/null.h
12537+++ b/lib/yamlcpp/include/yaml-cpp/null.h
12538@@ -21,6 +21,6 @@ YAML_CPP_API bool IsNull(const Node& node); // old API only
12539 YAML_CPP_API bool IsNullString(const std::string& str);
12540
12541 extern YAML_CPP_API _Null Null;
12542-}
12543+} // namespace YAML
12544
12545 #endif // NULL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12546diff --git a/lib/yamlcpp/include/yaml-cpp/ostream_wrapper.h b/lib/yamlcpp/include/yaml-cpp/ostream_wrapper.h
12547index 09d45f39b..b9dbbab0e 100644
12548--- a/lib/yamlcpp/include/yaml-cpp/ostream_wrapper.h
12549+++ b/lib/yamlcpp/include/yaml-cpp/ostream_wrapper.h
12550@@ -52,7 +52,7 @@ class YAML_CPP_API ostream_wrapper {
12551
12552 template <std::size_t N>
12553 inline ostream_wrapper& operator<<(ostream_wrapper& stream,
12554- const char(&str)[N]) {
12555+ const char (&str)[N]) {
12556 stream.write(str, N - 1);
12557 return stream;
12558 }
12559@@ -67,6 +67,6 @@ inline ostream_wrapper& operator<<(ostream_wrapper& stream, char ch) {
12560 stream.write(&ch, 1);
12561 return stream;
12562 }
12563-}
12564+} // namespace YAML
12565
12566 #endif // OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12567diff --git a/lib/yamlcpp/include/yaml-cpp/parser.h b/lib/yamlcpp/include/yaml-cpp/parser.h
12568index ceac22d02..68a60ae74 100644
12569--- a/lib/yamlcpp/include/yaml-cpp/parser.h
12570+++ b/lib/yamlcpp/include/yaml-cpp/parser.h
12571@@ -81,6 +81,6 @@ class YAML_CPP_API Parser : private noncopyable {
12572 std::unique_ptr<Scanner> m_pScanner;
12573 std::unique_ptr<Directives> m_pDirectives;
12574 };
12575-}
12576+} // namespace YAML
12577
12578 #endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12579diff --git a/lib/yamlcpp/include/yaml-cpp/stlemitter.h b/lib/yamlcpp/include/yaml-cpp/stlemitter.h
12580index 06780c861..464630a37 100644
12581--- a/lib/yamlcpp/include/yaml-cpp/stlemitter.h
12582+++ b/lib/yamlcpp/include/yaml-cpp/stlemitter.h
12583@@ -7,10 +7,10 @@
12584 #pragma once
12585 #endif
12586
12587-#include <vector>
12588 #include <list>
12589-#include <set>
12590 #include <map>
12591+#include <set>
12592+#include <vector>
12593
12594 namespace YAML {
12595 template <typename Seq>
12596@@ -46,6 +46,6 @@ inline Emitter& operator<<(Emitter& emitter, const std::map<K, V>& m) {
12597 emitter << EndMap;
12598 return emitter;
12599 }
12600-}
12601+} // namespace YAML
12602
12603 #endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12604diff --git a/lib/yamlcpp/include/yaml-cpp/traits.h b/lib/yamlcpp/include/yaml-cpp/traits.h
12605index f33d0e1f6..4b66df964 100644
12606--- a/lib/yamlcpp/include/yaml-cpp/traits.h
12607+++ b/lib/yamlcpp/include/yaml-cpp/traits.h
12608@@ -98,6 +98,6 @@ struct disable_if_c<true, T> {};
12609
12610 template <class Cond, class T = void>
12611 struct disable_if : public disable_if_c<Cond::value, T> {};
12612-}
12613+} // namespace YAML
12614
12615 #endif // TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12616diff --git a/lib/yamlcpp/include/yaml-cpp/yaml.h b/lib/yamlcpp/include/yaml-cpp/yaml.h
12617index 7f515efb9..faf8192e2 100644
12618--- a/lib/yamlcpp/include/yaml-cpp/yaml.h
12619+++ b/lib/yamlcpp/include/yaml-cpp/yaml.h
12620@@ -7,18 +7,18 @@
12621 #pragma once
12622 #endif
12623
12624-#include "yaml-cpp/parser.h"
12625 #include "yaml-cpp/emitter.h"
12626 #include "yaml-cpp/emitterstyle.h"
12627-#include "yaml-cpp/stlemitter.h"
12628 #include "yaml-cpp/exceptions.h"
12629+#include "yaml-cpp/parser.h"
12630+#include "yaml-cpp/stlemitter.h"
12631
12632-#include "yaml-cpp/node/node.h"
12633-#include "yaml-cpp/node/impl.h"
12634 #include "yaml-cpp/node/convert.h"
12635-#include "yaml-cpp/node/iterator.h"
12636 #include "yaml-cpp/node/detail/impl.h"
12637-#include "yaml-cpp/node/parse.h"
12638 #include "yaml-cpp/node/emit.h"
12639+#include "yaml-cpp/node/impl.h"
12640+#include "yaml-cpp/node/iterator.h"
12641+#include "yaml-cpp/node/node.h"
12642+#include "yaml-cpp/node/parse.h"
12643
12644 #endif // YAML_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12645diff --git a/lib/yamlcpp/src/collectionstack.h b/lib/yamlcpp/src/collectionstack.h
12646index 2302786e0..9c1f59592 100644
12647--- a/lib/yamlcpp/src/collectionstack.h
12648+++ b/lib/yamlcpp/src/collectionstack.h
12649@@ -7,8 +7,8 @@
12650 #pragma once
12651 #endif
12652
12653-#include <stack>
12654 #include <cassert>
12655+#include <stack>
12656
12657 namespace YAML {
12658 struct CollectionType {
12659@@ -34,6 +34,6 @@ class CollectionStack {
12660 private:
12661 std::stack<CollectionType::value> collectionStack;
12662 };
12663-}
12664+} // namespace YAML
12665
12666 #endif // COLLECTIONSTACK_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12667diff --git a/lib/yamlcpp/src/contrib/graphbuilderadapter.h b/lib/yamlcpp/src/contrib/graphbuilderadapter.h
12668index 0d1e57920..b17ccc7da 100644
12669--- a/lib/yamlcpp/src/contrib/graphbuilderadapter.h
12670+++ b/lib/yamlcpp/src/contrib/graphbuilderadapter.h
12671@@ -74,6 +74,6 @@ class GraphBuilderAdapter : public EventHandler {
12672 void RegisterAnchor(anchor_t anchor, void* pNode);
12673 void DispositionNode(void* pNode);
12674 };
12675-}
12676+} // namespace YAML
12677
12678 #endif // GRAPHBUILDERADAPTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12679diff --git a/lib/yamlcpp/src/directives.h b/lib/yamlcpp/src/directives.h
12680index 333af26e3..6d2ba76d6 100644
12681--- a/lib/yamlcpp/src/directives.h
12682+++ b/lib/yamlcpp/src/directives.h
12683@@ -7,8 +7,8 @@
12684 #pragma once
12685 #endif
12686
12687-#include <string>
12688 #include <map>
12689+#include <string>
12690
12691 namespace YAML {
12692 struct Version {
12693@@ -24,6 +24,6 @@ struct Directives {
12694 Version version;
12695 std::map<std::string, std::string> tags;
12696 };
12697-}
12698+} // namespace YAML
12699
12700 #endif // DIRECTIVES_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12701diff --git a/lib/yamlcpp/src/emitterstate.h b/lib/yamlcpp/src/emitterstate.h
12702index 0937f000d..08a4d5a18 100644
12703--- a/lib/yamlcpp/src/emitterstate.h
12704+++ b/lib/yamlcpp/src/emitterstate.h
12705@@ -198,6 +198,6 @@ void EmitterState::_Set(Setting<T>& fmt, T value, FmtScope::value scope) {
12706 assert(false);
12707 }
12708 }
12709-}
12710+} // namespace YAML
12711
12712 #endif // EMITTERSTATE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12713diff --git a/lib/yamlcpp/src/emitterutils.h b/lib/yamlcpp/src/emitterutils.h
12714index 6cc731914..9a7be0a07 100644
12715--- a/lib/yamlcpp/src/emitterutils.h
12716+++ b/lib/yamlcpp/src/emitterutils.h
12717@@ -44,7 +44,7 @@ bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim);
12718 bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix,
12719 const std::string& tag);
12720 bool WriteBinary(ostream_wrapper& out, const Binary& binary);
12721-}
12722-}
12723+} // namespace Utils
12724+} // namespace YAML
12725
12726 #endif // EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12727diff --git a/lib/yamlcpp/src/indentation.h b/lib/yamlcpp/src/indentation.h
12728index 1a2ccaea2..8d2797b0e 100644
12729--- a/lib/yamlcpp/src/indentation.h
12730+++ b/lib/yamlcpp/src/indentation.h
12731@@ -7,8 +7,8 @@
12732 #pragma once
12733 #endif
12734
12735-#include <iostream>
12736 #include <cstddef>
12737+#include <iostream>
12738
12739 #include "yaml-cpp/ostream_wrapper.h"
12740
12741@@ -36,6 +36,6 @@ inline ostream_wrapper& operator<<(ostream_wrapper& out,
12742 out << ' ';
12743 return out;
12744 }
12745-}
12746+} // namespace YAML
12747
12748 #endif // INDENTATION_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12749diff --git a/lib/yamlcpp/src/nodebuilder.h b/lib/yamlcpp/src/nodebuilder.h
12750index a6a47f007..11ed2ff12 100644
12751--- a/lib/yamlcpp/src/nodebuilder.h
12752+++ b/lib/yamlcpp/src/nodebuilder.h
12753@@ -65,6 +65,6 @@ class NodeBuilder : public EventHandler {
12754 std::vector<PushedKey> m_keys;
12755 std::size_t m_mapDepth;
12756 };
12757-}
12758+} // namespace YAML
12759
12760 #endif // NODE_NODEBUILDER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12761diff --git a/lib/yamlcpp/src/nodeevents.h b/lib/yamlcpp/src/nodeevents.h
12762index 49c18eb85..8c0822454 100644
12763--- a/lib/yamlcpp/src/nodeevents.h
12764+++ b/lib/yamlcpp/src/nodeevents.h
12765@@ -59,6 +59,6 @@ class NodeEvents {
12766 typedef std::map<const detail::node_ref*, int> RefCount;
12767 RefCount m_refCount;
12768 };
12769-}
12770+} // namespace YAML
12771
12772 #endif // NODE_NODEEVENTS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12773diff --git a/lib/yamlcpp/src/ptr_vector.h b/lib/yamlcpp/src/ptr_vector.h
12774index 955aebd8d..967c6e7b7 100644
12775--- a/lib/yamlcpp/src/ptr_vector.h
12776+++ b/lib/yamlcpp/src/ptr_vector.h
12777@@ -38,6 +38,6 @@ class ptr_vector : private YAML::noncopyable {
12778 private:
12779 std::vector<std::unique_ptr<T>> m_data;
12780 };
12781-}
12782+} // namespace YAML
12783
12784 #endif // PTR_VECTOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12785diff --git a/lib/yamlcpp/src/regex_yaml.h b/lib/yamlcpp/src/regex_yaml.h
12786index 8f28b852a..d554b2512 100644
12787--- a/lib/yamlcpp/src/regex_yaml.h
12788+++ b/lib/yamlcpp/src/regex_yaml.h
12789@@ -80,7 +80,7 @@ class YAML_CPP_API RegEx {
12790 char m_a, m_z;
12791 std::vector<RegEx> m_params;
12792 };
12793-}
12794+} // namespace YAML
12795
12796 #include "regeximpl.h"
12797
12798diff --git a/lib/yamlcpp/src/regeximpl.h b/lib/yamlcpp/src/regeximpl.h
12799index 709124f00..05edda166 100644
12800--- a/lib/yamlcpp/src/regeximpl.h
12801+++ b/lib/yamlcpp/src/regeximpl.h
12802@@ -8,8 +8,8 @@
12803 #endif
12804
12805 #include "stream.h"
12806-#include "stringsource.h"
12807 #include "streamcharsource.h"
12808+#include "stringsource.h"
12809
12810 namespace YAML {
12811 // query matches
12812@@ -106,9 +106,8 @@ inline int RegEx::MatchOpEmpty(const Source& source) const {
12813 template <>
12814 inline int RegEx::MatchOpEmpty<StringCharSource>(
12815 const StringCharSource& source) const {
12816- return !source
12817- ? 0
12818- : -1; // the empty regex only is successful on the empty string
12819+ return !source ? 0 : -1; // the empty regex only is successful on the empty
12820+ // string
12821 }
12822
12823 // MatchOperator
12824@@ -181,6 +180,6 @@ inline int RegEx::MatchOpSeq(const Source& source) const {
12825
12826 return offset;
12827 }
12828-}
12829+} // namespace YAML
12830
12831 #endif // REGEXIMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12832diff --git a/lib/yamlcpp/src/scanner.h b/lib/yamlcpp/src/scanner.h
12833index 7bb2ccc71..5787d9783 100644
12834--- a/lib/yamlcpp/src/scanner.h
12835+++ b/lib/yamlcpp/src/scanner.h
12836@@ -185,6 +185,6 @@ class Scanner {
12837 ptr_vector<IndentMarker> m_indentRefs; // for "garbage collection"
12838 std::stack<FLOW_MARKER> m_flows;
12839 };
12840-}
12841+} // namespace YAML
12842
12843 #endif // SCANNER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12844diff --git a/lib/yamlcpp/src/scanscalar.h b/lib/yamlcpp/src/scanscalar.h
12845index c3a574ad9..b8975946b 100644
12846--- a/lib/yamlcpp/src/scanscalar.h
12847+++ b/lib/yamlcpp/src/scanscalar.h
12848@@ -58,6 +58,6 @@ struct ScanScalarParams {
12849 };
12850
12851 std::string ScanScalar(Stream& INPUT, ScanScalarParams& info);
12852-}
12853+} // namespace YAML
12854
12855 #endif // SCANSCALAR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12856diff --git a/lib/yamlcpp/src/scantag.h b/lib/yamlcpp/src/scantag.h
12857index 522ba5495..61e4b86e1 100644
12858--- a/lib/yamlcpp/src/scantag.h
12859+++ b/lib/yamlcpp/src/scantag.h
12860@@ -7,13 +7,13 @@
12861 #pragma once
12862 #endif
12863
12864-#include <string>
12865 #include "stream.h"
12866+#include <string>
12867
12868 namespace YAML {
12869 const std::string ScanVerbatimTag(Stream& INPUT);
12870 const std::string ScanTagHandle(Stream& INPUT, bool& canBeHandle);
12871 const std::string ScanTagSuffix(Stream& INPUT);
12872-}
12873+} // namespace YAML
12874
12875 #endif // SCANTAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12876diff --git a/lib/yamlcpp/src/setting.h b/lib/yamlcpp/src/setting.h
12877index b78d40e2e..cf9d16b8e 100644
12878--- a/lib/yamlcpp/src/setting.h
12879+++ b/lib/yamlcpp/src/setting.h
12880@@ -7,9 +7,9 @@
12881 #pragma once
12882 #endif
12883
12884+#include "yaml-cpp/noncopyable.h"
12885 #include <memory>
12886 #include <vector>
12887-#include "yaml-cpp/noncopyable.h"
12888
12889 namespace YAML {
12890 class SettingChangeBase;
12891@@ -90,6 +90,6 @@ class SettingChanges : private noncopyable {
12892 typedef std::vector<std::unique_ptr<SettingChangeBase>> setting_changes;
12893 setting_changes m_settingChanges;
12894 };
12895-}
12896+} // namespace YAML
12897
12898 #endif // SETTING_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12899diff --git a/lib/yamlcpp/src/singledocparser.h b/lib/yamlcpp/src/singledocparser.h
12900index 2b92067cd..c30bea68c 100644
12901--- a/lib/yamlcpp/src/singledocparser.h
12902+++ b/lib/yamlcpp/src/singledocparser.h
12903@@ -60,6 +60,6 @@ class SingleDocParser : private noncopyable {
12904
12905 anchor_t m_curAnchor;
12906 };
12907-}
12908+} // namespace YAML
12909
12910 #endif // SINGLEDOCPARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12911diff --git a/lib/yamlcpp/src/stream.h b/lib/yamlcpp/src/stream.h
12912index 42d542d5b..f8f7dd23e 100644
12913--- a/lib/yamlcpp/src/stream.h
12914+++ b/lib/yamlcpp/src/stream.h
12915@@ -7,8 +7,8 @@
12916 #pragma once
12917 #endif
12918
12919-#include "yaml-cpp/noncopyable.h"
12920 #include "yaml-cpp/mark.h"
12921+#include "yaml-cpp/noncopyable.h"
12922 #include <cstddef>
12923 #include <deque>
12924 #include <ios>
12925@@ -71,6 +71,6 @@ inline bool Stream::ReadAheadTo(size_t i) const {
12926 return true;
12927 return _ReadAheadTo(i);
12928 }
12929-}
12930+} // namespace YAML
12931
12932 #endif // STREAM_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12933diff --git a/lib/yamlcpp/src/streamcharsource.h b/lib/yamlcpp/src/streamcharsource.h
12934index 624599e65..26536cdf2 100644
12935--- a/lib/yamlcpp/src/streamcharsource.h
12936+++ b/lib/yamlcpp/src/streamcharsource.h
12937@@ -43,6 +43,6 @@ inline const StreamCharSource StreamCharSource::operator+(int i) const {
12938 source.m_offset = 0;
12939 return source;
12940 }
12941-}
12942+} // namespace YAML
12943
12944 #endif // STREAMCHARSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12945diff --git a/lib/yamlcpp/src/stringsource.h b/lib/yamlcpp/src/stringsource.h
12946index 6fee44bb2..b772e6722 100644
12947--- a/lib/yamlcpp/src/stringsource.h
12948+++ b/lib/yamlcpp/src/stringsource.h
12949@@ -43,6 +43,6 @@ class StringCharSource {
12950 std::size_t m_size;
12951 std::size_t m_offset;
12952 };
12953-}
12954+} // namespace YAML
12955
12956 #endif // STRINGSOURCE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12957diff --git a/lib/yamlcpp/src/tag.h b/lib/yamlcpp/src/tag.h
12958index ac30673b9..854d4b215 100644
12959--- a/lib/yamlcpp/src/tag.h
12960+++ b/lib/yamlcpp/src/tag.h
12961@@ -28,6 +28,6 @@ struct Tag {
12962 TYPE type;
12963 std::string handle, value;
12964 };
12965-}
12966+} // namespace YAML
12967
12968 #endif // TAG_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12969diff --git a/lib/yamlcpp/src/token.h b/lib/yamlcpp/src/token.h
12970index ad0b7d0a0..b9c5b4fe6 100644
12971--- a/lib/yamlcpp/src/token.h
12972+++ b/lib/yamlcpp/src/token.h
12973@@ -14,10 +14,11 @@
12974
12975 namespace YAML {
12976 const std::string TokenNames[] = {
12977- "DIRECTIVE", "DOC_START", "DOC_END", "BLOCK_SEQ_START", "BLOCK_MAP_START",
12978- "BLOCK_SEQ_END", "BLOCK_MAP_END", "BLOCK_ENTRY", "FLOW_SEQ_START",
12979- "FLOW_MAP_START", "FLOW_SEQ_END", "FLOW_MAP_END", "FLOW_MAP_COMPACT",
12980- "FLOW_ENTRY", "KEY", "VALUE", "ANCHOR", "ALIAS", "TAG", "SCALAR"};
12981+ "DIRECTIVE", "DOC_START", "DOC_END", "BLOCK_SEQ_START",
12982+ "BLOCK_MAP_START", "BLOCK_SEQ_END", "BLOCK_MAP_END", "BLOCK_ENTRY",
12983+ "FLOW_SEQ_START", "FLOW_MAP_START", "FLOW_SEQ_END", "FLOW_MAP_END",
12984+ "FLOW_MAP_COMPACT", "FLOW_ENTRY", "KEY", "VALUE",
12985+ "ANCHOR", "ALIAS", "TAG", "SCALAR"};
12986
12987 struct Token {
12988 // enums
12989@@ -64,6 +65,6 @@ struct Token {
12990 std::vector<std::string> params;
12991 int data;
12992 };
12993-}
12994+} // namespace YAML
12995
12996 #endif // TOKEN_H_62B23520_7C8E_11DE_8A39_0800200C9A66
12997diff --git a/lib/yamlcpp/test/handler_test.h b/lib/yamlcpp/test/handler_test.h
12998index 668a58d01..595eb605c 100644
12999--- a/lib/yamlcpp/test/handler_test.h
13000+++ b/lib/yamlcpp/test/handler_test.h
13001@@ -29,4 +29,4 @@ class HandlerTest : public ::testing::Test {
13002 StrictMock<MockEventHandler> handler;
13003 NiceMock<MockEventHandler> nice_handler;
13004 };
13005-}
13006+} // namespace YAML
13007diff --git a/lib/yamlcpp/test/mock_event_handler.h b/lib/yamlcpp/test/mock_event_handler.h
13008index 49d1f0c33..cadf6984f 100644
13009--- a/lib/yamlcpp/test/mock_event_handler.h
13010+++ b/lib/yamlcpp/test/mock_event_handler.h
13011@@ -23,4 +23,4 @@ class MockEventHandler : public EventHandler {
13012 EmitterStyle::value));
13013 MOCK_METHOD0(OnMapEnd, void());
13014 };
13015-}
13016+} // namespace YAML
13017diff --git a/lib/yamlcpp/test/specexamples.h b/lib/yamlcpp/test/specexamples.h
13018index 3c81c7779..eb318e81e 100644
13019--- a/lib/yamlcpp/test/specexamples.h
13020+++ b/lib/yamlcpp/test/specexamples.h
13021@@ -843,4 +843,4 @@ const char *ex8_22 =
13022 " - nested\n"
13023 "mapping: !!map\n"
13024 " foo: bar\n";
13025-}
13026+} // namespace
13027diff --git a/mgmt/WebMgmtUtils.cc b/mgmt/WebMgmtUtils.cc
13028index 474114cec..a9a48cc82 100644
13029--- a/mgmt/WebMgmtUtils.cc
13030+++ b/mgmt/WebMgmtUtils.cc
13031@@ -1069,9 +1069,8 @@ recordIPCheck(const char *pattern, const char *value)
13032 // regex_t regex;
13033 // int result;
13034 bool check;
13035- const char *range_pattern =
13036- R"(\[[0-9]+\-[0-9]+\]\\\.\[[0-9]+\-[0-9]+\]\\\.\[[0-9]+\-[0-9]+\]\\\.\[[0-9]+\-[0-9]+\])";
13037- const char *ip_pattern = "[0-9]*[0-9]*[0-9].[0-9]*[0-9]*[0-9].[0-9]*[0-9]*[0-9].[0-9]*[0-9]*[0-9]";
13038+ const char *range_pattern = R"(\[[0-9]+\-[0-9]+\]\\\.\[[0-9]+\-[0-9]+\]\\\.\[[0-9]+\-[0-9]+\]\\\.\[[0-9]+\-[0-9]+\])";
13039+ const char *ip_pattern = "[0-9]*[0-9]*[0-9].[0-9]*[0-9]*[0-9].[0-9]*[0-9]*[0-9].[0-9]*[0-9]*[0-9]";
13040
13041 Tokenizer dotTok1(".");
13042 Tokenizer dotTok2(".");
13043diff --git a/mgmt/api/INKMgmtAPI.cc b/mgmt/api/INKMgmtAPI.cc
13044index 15d2caf8d..1c8158e30 100644
13045--- a/mgmt/api/INKMgmtAPI.cc
13046+++ b/mgmt/api/INKMgmtAPI.cc
13047@@ -697,7 +697,7 @@ TSTerminate()
13048
13049 /*--- plugin initialization -----------------------------------------------*/
13050 inkexp extern void
13051-TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
13052+TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */[])
13053 {
13054 }
13055
13056diff --git a/plugins/experimental/metalink/metalink.cc b/plugins/experimental/metalink/metalink.cc
13057index 95ccfd0a9..7e7bd5607 100644
13058--- a/plugins/experimental/metalink/metalink.cc
13059+++ b/plugins/experimental/metalink/metalink.cc
13060@@ -888,7 +888,7 @@ handler(TSCont contp, TSEvent event, void *edata)
13061 }
13062
13063 void
13064-TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
13065+TSPluginInit(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */[])
13066 {
13067 TSPluginRegistrationInfo info;
13068
13069diff --git a/plugins/generator/generator.cc b/plugins/generator/generator.cc
13070index 4dc7f4de0..e6e568283 100644
13071--- a/plugins/generator/generator.cc
13072+++ b/plugins/generator/generator.cc
13073@@ -642,7 +642,7 @@ GeneratorInitialize()
13074 }
13075
13076 void
13077-TSPluginInit(int /* argc */, const char * /* argv */ [])
13078+TSPluginInit(int /* argc */, const char * /* argv */[])
13079 {
13080 TSPluginRegistrationInfo info;
13081
13082@@ -676,8 +676,7 @@ TSRemapDoRemap(void * /* ih */, TSHttpTxn txn, TSRemapRequestInfo * /* rri ATS_U
13083 }
13084
13085 TSReturnCode
13086-TSRemapNewInstance(int /* argc */, char * /* argv */ [], void **ih, char * /* errbuf ATS_UNUSED */,
13087- int /* errbuf_size ATS_UNUSED */)
13088+TSRemapNewInstance(int /* argc */, char * /* argv */[], void **ih, char * /* errbuf ATS_UNUSED */, int /* errbuf_size ATS_UNUSED */)
13089 {
13090 *ih = nullptr;
13091 return TS_SUCCESS;
13092diff --git a/proxy/http/remap/RemapConfig.cc b/proxy/http/remap/RemapConfig.cc
13093index 6b5a5e990..29368d605 100644
13094--- a/proxy/http/remap/RemapConfig.cc
13095+++ b/proxy/http/remap/RemapConfig.cc
13096@@ -808,16 +808,14 @@ remap_load_plugin(const char **argv, int argc, url_mapping *mp, char *errbuf, in
13097 snprintf(errbuf, errbufsize, R"(Can't find "%s" function in remap plugin "%s")", TSREMAP_FUNCNAME_INIT, c);
13098 retcode = -10;
13099 } else if (!pi->new_instance_cb && pi->delete_instance_cb) {
13100- snprintf(errbuf, errbufsize,
13101- R"(Can't find "%s" function in remap plugin "%s" which is required if "%s" function exists)",
13102+ snprintf(errbuf, errbufsize, R"(Can't find "%s" function in remap plugin "%s" which is required if "%s" function exists)",
13103 TSREMAP_FUNCNAME_NEW_INSTANCE, c, TSREMAP_FUNCNAME_DELETE_INSTANCE);
13104 retcode = -11;
13105 } else if (!pi->do_remap_cb) {
13106 snprintf(errbuf, errbufsize, R"(Can't find "%s" function in remap plugin "%s")", TSREMAP_FUNCNAME_DO_REMAP, c);
13107 retcode = -12;
13108 } else if (pi->new_instance_cb && !pi->delete_instance_cb) {
13109- snprintf(errbuf, errbufsize,
13110- R"(Can't find "%s" function in remap plugin "%s" which is required if "%s" function exists)",
13111+ snprintf(errbuf, errbufsize, R"(Can't find "%s" function in remap plugin "%s" which is required if "%s" function exists)",
13112 TSREMAP_FUNCNAME_DELETE_INSTANCE, c, TSREMAP_FUNCNAME_NEW_INSTANCE);
13113 retcode = -13;
13114 }
13115diff --git a/src/tscore/BufferWriterFormat.cc b/src/tscore/BufferWriterFormat.cc
13116index 70a5e0162..13965eda7 100644
13117--- a/src/tscore/BufferWriterFormat.cc
13118+++ b/src/tscore/BufferWriterFormat.cc
13119@@ -468,17 +468,18 @@ namespace bw_fmt
13120 }
13121 w.write(digits);
13122 } else { // use generic Write_Aligned
13123- Write_Aligned(w,
13124- [&]() {
13125- if (prefix1) {
13126- w.write(prefix1);
13127- if (prefix2) {
13128- w.write(prefix2);
13129- }
13130- }
13131- w.write(digits);
13132- },
13133- spec._align, width, spec._fill, neg);
13134+ Write_Aligned(
13135+ w,
13136+ [&]() {
13137+ if (prefix1) {
13138+ w.write(prefix1);
13139+ if (prefix2) {
13140+ w.write(prefix2);
13141+ }
13142+ }
13143+ w.write(digits);
13144+ },
13145+ spec._align, width, spec._fill, neg);
13146 }
13147 return w;
13148 }
13149@@ -575,13 +576,14 @@ namespace bw_fmt
13150 std::string_view whole_digits{whole + sizeof(whole) - l, l};
13151 std::string_view frac_digits{fraction + sizeof(fraction) - r, r};
13152
13153- Write_Aligned(w,
13154- [&]() {
13155- w.write(whole_digits);
13156- w.write(dec);
13157- w.write(frac_digits);
13158- },
13159- spec._align, width, spec._fill, neg);
13160+ Write_Aligned(
13161+ w,
13162+ [&]() {
13163+ w.write(whole_digits);
13164+ w.write(dec);
13165+ w.write(frac_digits);
13166+ },
13167+ spec._align, width, spec._fill, neg);
13168
13169 return w;
13170 }
13171@@ -612,7 +614,8 @@ bwformat(BufferWriter &w, BWFSpec const &spec, std::string_view sv)
13172 return bwformat(w, spec, bwf::detail::MemDump(sv.data(), sv.size()));
13173 } else {
13174 width -= sv.size();
13175- bw_fmt::Write_Aligned(w, [&w, &sv]() { w.write(sv); }, spec._align, width, spec._fill, 0);
13176+ bw_fmt::Write_Aligned(
13177+ w, [&w, &sv]() { w.write(sv); }, spec._align, width, spec._fill, 0);
13178 }
13179 return w;
13180 }
13181@@ -964,8 +967,8 @@ bwformat(BufferWriter &w, BWFSpec const &spec, bwf::detail::MemDump const &hex)
13182 w.write(fmt_type);
13183 width -= 2;
13184 }
13185- bw_fmt::Write_Aligned(w, [&w, &hex, digits]() { bw_fmt::Format_As_Hex(w, hex._view, digits); }, spec._align, width, spec._fill,
13186- 0);
13187+ bw_fmt::Write_Aligned(
13188+ w, [&w, &hex, digits]() { bw_fmt::Format_As_Hex(w, hex._view, digits); }, spec._align, width, spec._fill, 0);
13189 return w;
13190 }
13191
13192diff --git a/src/tscore/test_atomic.cc b/src/tscore/test_atomic.cc
13193index 41107d5c6..6b59e08e5 100644
13194--- a/src/tscore/test_atomic.cc
13195+++ b/src/tscore/test_atomic.cc
13196@@ -139,7 +139,7 @@ cycle_data(void *d)
13197 #endif // LONG_ATOMICLIST_TEST
13198
13199 int
13200-main(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */ [])
13201+main(int /* argc ATS_UNUSED */, const char * /* argv ATS_UNUSED */[])
13202 {
13203 #ifndef LONG_ATOMICLIST_TEST
13204 int32_t m = 1, n = 100;
13205diff --git a/src/tscore/test_freelist.cc b/src/tscore/test_freelist.cc
13206index 3fdc27ab2..98ab1275c 100644
13207--- a/src/tscore/test_freelist.cc
13208+++ b/src/tscore/test_freelist.cc
13209@@ -66,7 +66,7 @@ test(void *d)
13210 }
13211
13212 int
13213-main(int /* argc ATS_UNUSED */, char * /*argv ATS_UNUSED */ [])
13214+main(int /* argc ATS_UNUSED */, char * /*argv ATS_UNUSED */[])
13215 {
13216 int i;