فهرست منبع

ncd: NCDConfigParser_parse: simplify grammar

ambrop7 14 سال پیش
والد
کامیت
7471c0595f
5فایلهای تغییر یافته به همراه366 افزوده شده و 446 حذف شده
  1. 170 192
      generated/NCDConfigParser_parse.c
  2. 2 2
      generated/NCDConfigParser_parse.h
  3. 148 196
      generated/NCDConfigParser_parse.out
  4. 23 28
      generated/NCDConfigParser_parse.y
  5. 23 28
      ncd/NCDConfigParser_parse.y

+ 170 - 192
generated/NCDConfigParser_parse.c

@@ -70,18 +70,18 @@ struct parser_out {
 **                       defined, then do no error processing.
 */
 #define YYCODETYPE unsigned char
-#define YYNOCODE 24
+#define YYNOCODE 25
 #define YYACTIONTYPE unsigned char
 #define ParseTOKENTYPE void *
 typedef union {
   int yyinit;
   ParseTOKENTYPE yy0;
-  int yy6;
-  struct NCDConfig_strings * yy10;
-  struct NCDConfig_list * yy24;
-  struct NCDConfig_statements * yy34;
-  struct NCDConfig_processes * yy41;
-  char * yy45;
+  char * yy1;
+  struct NCDConfig_list * yy14;
+  struct NCDConfig_processes * yy21;
+  int yy28;
+  struct NCDConfig_statements * yy38;
+  struct NCDConfig_strings * yy44;
 } YYMINORTYPE;
 #ifndef YYSTACKDEPTH
 #define YYSTACKDEPTH 0
@@ -90,8 +90,8 @@ typedef union {
 #define ParseARG_PDECL ,struct parser_out *parser_out
 #define ParseARG_FETCH struct parser_out *parser_out = yypParser->parser_out
 #define ParseARG_STORE yypParser->parser_out = parser_out
-#define YYNSTATE 43
-#define YYNRULE 23
+#define YYNSTATE 40
+#define YYNRULE 22
 #define YY_NO_ACTION      (YYNSTATE+YYNRULE+2)
 #define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
 #define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)
@@ -161,42 +161,39 @@ static const YYMINORTYPE yyzerominor = { 0 };
 **  yy_default[]       Default action for each state.
 */
 static const YYACTIONTYPE yy_action[] = {
- /*     0 */    24,   20,   36,   25,   24,   28,   36,   25,   22,    3,
- /*    10 */    38,   16,   22,    3,   31,   32,   23,   34,   17,   67,
- /*    20 */    23,   24,   22,   26,   25,   24,   35,   41,   25,   24,
- /*    30 */    30,   40,   25,   24,   21,   37,   25,   17,   27,   19,
- /*    40 */    15,   33,   15,   42,   15,    1,   43,   29,   13,   18,
- /*    50 */     7,    8,   12,    4,   68,   11,   68,    9,    2,   39,
- /*    60 */    68,   68,    5,    6,   14,   68,   10,
+ /*     0 */    37,   18,   32,   38,   21,   37,   24,   32,   38,   21,
+ /*    10 */    20,    3,   34,   37,   20,   22,   38,   21,   37,   36,
+ /*    20 */    33,   38,   21,   31,   14,   19,   20,    3,   27,   28,
+ /*    30 */    26,   30,   15,   63,   23,   36,   17,   13,   15,   40,
+ /*    40 */    25,   16,   29,   13,   39,   13,    6,    1,    5,   10,
+ /*    50 */    11,    9,   35,    7,    2,   64,   12,    4,    8,
 };
 static const YYCODETYPE yy_lookahead[] = {
- /*     0 */    16,   17,   18,   19,   16,   17,   18,   19,    1,    2,
- /*    10 */     3,   14,    1,    2,   11,   12,    9,   16,   21,   22,
- /*    20 */     9,   16,    1,   18,   19,   16,    1,   18,   19,   16,
- /*    30 */    14,   18,   19,   16,   20,   18,   19,   21,   16,   15,
- /*    40 */    16,   15,   16,   15,   16,    4,    0,   20,    7,    1,
- /*    50 */     3,    2,    8,   10,   23,    5,   23,    6,    4,    3,
- /*    60 */    23,   23,   10,   10,    5,   23,    6,
+ /*     0 */    16,   17,   18,   19,   20,   16,   17,   18,   19,   20,
+ /*    10 */     1,    2,    3,   16,    1,   18,   19,   20,   16,   10,
+ /*    20 */    18,   19,   20,    1,   14,   21,    1,    2,   11,   12,
+ /*    30 */    14,   16,   22,   23,   16,   10,   15,   16,   22,    0,
+ /*    40 */    21,    1,   15,   16,   15,   16,    2,    4,    3,    8,
+ /*    50 */     7,    5,    3,    6,    4,   24,    5,    9,    6,
 };
 #define YY_SHIFT_USE_DFLT (-1)
-#define YY_SHIFT_MAX 29
+#define YY_SHIFT_MAX 25
 static const signed char yy_shift_ofst[] = {
- /*     0 */     3,   11,   11,    7,   11,   11,   11,    3,   21,   21,
- /*    10 */    21,   25,   21,   21,   25,   41,   46,   48,   49,   47,
- /*    20 */    50,   51,   44,   43,   52,   53,   56,   54,   59,   60,
+ /*     0 */    17,   25,   25,    9,   25,   17,   13,   13,   13,   22,
+ /*    10 */    13,   13,   22,   43,   39,   40,   44,   45,   46,   47,
+ /*    20 */    41,   48,   49,   50,   51,   52,
 };
 #define YY_REDUCE_USE_DFLT (-17)
-#define YY_REDUCE_MAX 14
+#define YY_REDUCE_MAX 12
 static const signed char yy_reduce_ofst[] = {
- /*     0 */    -3,  -16,  -12,    5,    9,   13,   17,   16,   24,   26,
- /*    10 */    28,   14,    1,   22,   27,
+ /*     0 */    10,  -16,  -11,   -3,    2,   16,   21,   27,   29,    4,
+ /*    10 */    15,   18,   19,
 };
 static const YYACTIONTYPE yy_default[] = {
- /*     0 */    66,   52,   52,   66,   66,   66,   66,   44,   66,   46,
- /*    10 */    48,   62,   66,   66,   62,   66,   66,   66,   66,   66,
- /*    20 */    66,   66,   50,   54,   55,   56,   66,   66,   66,   66,
- /*    30 */    45,   64,   65,   47,   51,   63,   53,   59,   60,   61,
- /*    40 */    58,   57,   49,
+ /*     0 */    62,   49,   49,   62,   62,   41,   62,   43,   45,   58,
+ /*    10 */    62,   62,   58,   62,   62,   62,   62,   62,   62,   62,
+ /*    20 */    47,   51,   62,   62,   62,   62,   42,   60,   61,   44,
+ /*    30 */    48,   59,   50,   52,   53,   54,   55,   56,   57,   46,
 };
 #define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))
 
@@ -292,10 +289,10 @@ void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
 static const char *const yyTokenName[] = { 
   "$",             "NAME",          "CURLY_OPEN",    "CURLY_CLOSE", 
   "ROUND_OPEN",    "ROUND_CLOSE",   "SEMICOLON",     "ARROW",       
-  "DOT",           "STRING",        "COMMA",         "PROCESS",     
+  "DOT",           "COMMA",         "STRING",        "PROCESS",     
   "TEMPLATE",      "error",         "processes",     "statements",  
   "statement_names",  "statement_args_maybe",  "list_contents",  "list",        
-  "name_maybe",    "process_or_template",  "input",       
+  "value",         "name_maybe",    "process_or_template",  "input",       
 };
 #endif /* NDEBUG */
 
@@ -314,18 +311,17 @@ static const char *const yyRuleName[] = {
  /*   8 */ "statement_names ::= NAME DOT statement_names",
  /*   9 */ "statement_args_maybe ::=",
  /*  10 */ "statement_args_maybe ::= list_contents",
- /*  11 */ "list_contents ::= STRING",
- /*  12 */ "list_contents ::= statement_names",
- /*  13 */ "list_contents ::= list",
- /*  14 */ "list_contents ::= STRING COMMA list_contents",
- /*  15 */ "list_contents ::= statement_names COMMA list_contents",
- /*  16 */ "list_contents ::= list COMMA list_contents",
- /*  17 */ "list ::= CURLY_OPEN CURLY_CLOSE",
- /*  18 */ "list ::= CURLY_OPEN list_contents CURLY_CLOSE",
- /*  19 */ "name_maybe ::=",
- /*  20 */ "name_maybe ::= NAME",
- /*  21 */ "process_or_template ::= PROCESS",
- /*  22 */ "process_or_template ::= TEMPLATE",
+ /*  11 */ "list_contents ::= value",
+ /*  12 */ "list_contents ::= value COMMA list_contents",
+ /*  13 */ "list ::= CURLY_OPEN CURLY_CLOSE",
+ /*  14 */ "list ::= CURLY_OPEN list_contents CURLY_CLOSE",
+ /*  15 */ "value ::= STRING",
+ /*  16 */ "value ::= statement_names",
+ /*  17 */ "value ::= list",
+ /*  18 */ "name_maybe ::=",
+ /*  19 */ "name_maybe ::= NAME",
+ /*  20 */ "process_or_template ::= PROCESS",
+ /*  21 */ "process_or_template ::= TEMPLATE",
 };
 #endif /* NDEBUG */
 
@@ -413,51 +409,52 @@ static void yy_destructor(
     case 6: /* SEMICOLON */
     case 7: /* ARROW */
     case 8: /* DOT */
-    case 9: /* STRING */
-    case 10: /* COMMA */
+    case 9: /* COMMA */
+    case 10: /* STRING */
     case 11: /* PROCESS */
     case 12: /* TEMPLATE */
 {
 #line 50 "NCDConfigParser_parse.y"
  free((yypminor->yy0)); 
-#line 424 "NCDConfigParser_parse.c"
+#line 420 "NCDConfigParser_parse.c"
 }
       break;
     case 14: /* processes */
 {
-#line 61 "NCDConfigParser_parse.y"
- NCDConfig_free_processes((yypminor->yy41)); 
-#line 431 "NCDConfigParser_parse.c"
+#line 62 "NCDConfigParser_parse.y"
+ NCDConfig_free_processes((yypminor->yy21)); 
+#line 427 "NCDConfigParser_parse.c"
 }
       break;
     case 15: /* statements */
 {
-#line 62 "NCDConfigParser_parse.y"
- NCDConfig_free_statements((yypminor->yy34)); 
-#line 438 "NCDConfigParser_parse.c"
+#line 63 "NCDConfigParser_parse.y"
+ NCDConfig_free_statements((yypminor->yy38)); 
+#line 434 "NCDConfigParser_parse.c"
 }
       break;
     case 16: /* statement_names */
 {
-#line 63 "NCDConfigParser_parse.y"
- NCDConfig_free_strings((yypminor->yy10)); 
-#line 445 "NCDConfigParser_parse.c"
+#line 64 "NCDConfigParser_parse.y"
+ NCDConfig_free_strings((yypminor->yy44)); 
+#line 441 "NCDConfigParser_parse.c"
 }
       break;
     case 17: /* statement_args_maybe */
     case 18: /* list_contents */
     case 19: /* list */
+    case 20: /* value */
 {
-#line 64 "NCDConfigParser_parse.y"
- NCDConfig_free_list((yypminor->yy24)); 
-#line 454 "NCDConfigParser_parse.c"
+#line 65 "NCDConfigParser_parse.y"
+ NCDConfig_free_list((yypminor->yy14)); 
+#line 451 "NCDConfigParser_parse.c"
 }
       break;
-    case 20: /* name_maybe */
+    case 21: /* name_maybe */
 {
-#line 67 "NCDConfigParser_parse.y"
- free((yypminor->yy45)); 
-#line 461 "NCDConfigParser_parse.c"
+#line 69 "NCDConfigParser_parse.y"
+ free((yypminor->yy1)); 
+#line 458 "NCDConfigParser_parse.c"
 }
       break;
     default:  break;   /* If no destructor action specified: do nothing */
@@ -630,12 +627,12 @@ static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
    while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
    /* Here code is inserted which will execute if the parser
    ** stack every overflows */
-#line 76 "NCDConfigParser_parse.y"
+#line 78 "NCDConfigParser_parse.y"
 
     if (yypMinor) {
         free(yypMinor->yy0);
     }
-#line 639 "NCDConfigParser_parse.c"
+#line 636 "NCDConfigParser_parse.c"
    ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
 }
 
@@ -692,7 +689,7 @@ static const struct {
   YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */
   unsigned char nrhs;     /* Number of right-hand side symbols in the rule */
 } yyRuleInfo[] = {
-  { 22, 1 },
+  { 23, 1 },
   { 14, 5 },
   { 14, 6 },
   { 15, 6 },
@@ -704,17 +701,16 @@ static const struct {
   { 17, 0 },
   { 17, 1 },
   { 18, 1 },
-  { 18, 1 },
-  { 18, 1 },
-  { 18, 3 },
-  { 18, 3 },
   { 18, 3 },
   { 19, 2 },
   { 19, 3 },
-  { 20, 0 },
   { 20, 1 },
+  { 20, 1 },
+  { 20, 1 },
+  { 21, 0 },
   { 21, 1 },
-  { 21, 1 },
+  { 22, 1 },
+  { 22, 1 },
 };
 
 static void yy_accept(yyParser*);  /* Forward Declaration */
@@ -770,71 +766,71 @@ static void yy_reduce(
   **     break;
   */
       case 0: /* input ::= processes */
-#line 82 "NCDConfigParser_parse.y"
+#line 84 "NCDConfigParser_parse.y"
 {
-    parser_out->ast = yymsp[0].minor.yy41;
+    parser_out->ast = yymsp[0].minor.yy21;
 
-    if (!yymsp[0].minor.yy41) {
+    if (!yymsp[0].minor.yy21) {
         parser_out->out_of_memory = 1;
     }
 }
-#line 782 "NCDConfigParser_parse.c"
+#line 778 "NCDConfigParser_parse.c"
         break;
       case 1: /* processes ::= process_or_template NAME CURLY_OPEN statements CURLY_CLOSE */
-#line 90 "NCDConfigParser_parse.y"
+#line 92 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy41 = NCDConfig_make_processes(yymsp[-4].minor.yy6, yymsp[-3].minor.yy0, yymsp[-1].minor.yy34, 0, NULL);
-    if (!yygotominor.yy41) {
+    yygotominor.yy21 = NCDConfig_make_processes(yymsp[-4].minor.yy28, yymsp[-3].minor.yy0, yymsp[-1].minor.yy38, 0, NULL);
+    if (!yygotominor.yy21) {
         parser_out->out_of_memory = 1;
     }
   yy_destructor(yypParser,2,&yymsp[-2].minor);
   yy_destructor(yypParser,3,&yymsp[0].minor);
 }
-#line 794 "NCDConfigParser_parse.c"
+#line 790 "NCDConfigParser_parse.c"
         break;
       case 2: /* processes ::= process_or_template NAME CURLY_OPEN statements CURLY_CLOSE processes */
-#line 97 "NCDConfigParser_parse.y"
+#line 99 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy41 = NCDConfig_make_processes(yymsp[-5].minor.yy6, yymsp[-4].minor.yy0, yymsp[-2].minor.yy34, 1, yymsp[0].minor.yy41);
-    if (!yygotominor.yy41) {
+    yygotominor.yy21 = NCDConfig_make_processes(yymsp[-5].minor.yy28, yymsp[-4].minor.yy0, yymsp[-2].minor.yy38, 1, yymsp[0].minor.yy21);
+    if (!yygotominor.yy21) {
         parser_out->out_of_memory = 1;
     }
   yy_destructor(yypParser,2,&yymsp[-3].minor);
   yy_destructor(yypParser,3,&yymsp[-1].minor);
 }
-#line 806 "NCDConfigParser_parse.c"
+#line 802 "NCDConfigParser_parse.c"
         break;
       case 3: /* statements ::= statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON */
-#line 104 "NCDConfigParser_parse.y"
+#line 106 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy34 = NCDConfig_make_statements(NULL, yymsp[-5].minor.yy10, yymsp[-3].minor.yy24, yymsp[-1].minor.yy45, NULL);
-    if (!yygotominor.yy34) {
+    yygotominor.yy38 = NCDConfig_make_statements(NULL, yymsp[-5].minor.yy44, yymsp[-3].minor.yy14, yymsp[-1].minor.yy1, NULL);
+    if (!yygotominor.yy38) {
         parser_out->out_of_memory = 1;
     }
   yy_destructor(yypParser,4,&yymsp[-4].minor);
   yy_destructor(yypParser,5,&yymsp[-2].minor);
   yy_destructor(yypParser,6,&yymsp[0].minor);
 }
-#line 819 "NCDConfigParser_parse.c"
+#line 815 "NCDConfigParser_parse.c"
         break;
       case 4: /* statements ::= statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON statements */
-#line 111 "NCDConfigParser_parse.y"
+#line 113 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy34 = NCDConfig_make_statements(NULL, yymsp[-6].minor.yy10, yymsp[-4].minor.yy24, yymsp[-2].minor.yy45, yymsp[0].minor.yy34);
-    if (!yygotominor.yy34) {
+    yygotominor.yy38 = NCDConfig_make_statements(NULL, yymsp[-6].minor.yy44, yymsp[-4].minor.yy14, yymsp[-2].minor.yy1, yymsp[0].minor.yy38);
+    if (!yygotominor.yy38) {
         parser_out->out_of_memory = 1;
     }
   yy_destructor(yypParser,4,&yymsp[-5].minor);
   yy_destructor(yypParser,5,&yymsp[-3].minor);
   yy_destructor(yypParser,6,&yymsp[-1].minor);
 }
-#line 832 "NCDConfigParser_parse.c"
+#line 828 "NCDConfigParser_parse.c"
         break;
       case 5: /* statements ::= statement_names ARROW statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON */
-#line 118 "NCDConfigParser_parse.y"
+#line 120 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy34 = NCDConfig_make_statements(yymsp[-7].minor.yy10, yymsp[-5].minor.yy10, yymsp[-3].minor.yy24, yymsp[-1].minor.yy45, NULL);
-    if (!yygotominor.yy34) {
+    yygotominor.yy38 = NCDConfig_make_statements(yymsp[-7].minor.yy44, yymsp[-5].minor.yy44, yymsp[-3].minor.yy14, yymsp[-1].minor.yy1, NULL);
+    if (!yygotominor.yy38) {
         parser_out->out_of_memory = 1;
     }
   yy_destructor(yypParser,7,&yymsp[-6].minor);
@@ -842,13 +838,13 @@ static void yy_reduce(
   yy_destructor(yypParser,5,&yymsp[-2].minor);
   yy_destructor(yypParser,6,&yymsp[0].minor);
 }
-#line 846 "NCDConfigParser_parse.c"
+#line 842 "NCDConfigParser_parse.c"
         break;
       case 6: /* statements ::= statement_names ARROW statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON statements */
-#line 125 "NCDConfigParser_parse.y"
+#line 127 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy34 = NCDConfig_make_statements(yymsp[-8].minor.yy10, yymsp[-6].minor.yy10, yymsp[-4].minor.yy24, yymsp[-2].minor.yy45, yymsp[0].minor.yy34);
-    if (!yygotominor.yy34) {
+    yygotominor.yy38 = NCDConfig_make_statements(yymsp[-8].minor.yy44, yymsp[-6].minor.yy44, yymsp[-4].minor.yy14, yymsp[-2].minor.yy1, yymsp[0].minor.yy38);
+    if (!yygotominor.yy38) {
         parser_out->out_of_memory = 1;
     }
   yy_destructor(yypParser,7,&yymsp[-7].minor);
@@ -856,153 +852,135 @@ static void yy_reduce(
   yy_destructor(yypParser,5,&yymsp[-3].minor);
   yy_destructor(yypParser,6,&yymsp[-1].minor);
 }
-#line 860 "NCDConfigParser_parse.c"
+#line 856 "NCDConfigParser_parse.c"
         break;
       case 7: /* statement_names ::= NAME */
-#line 132 "NCDConfigParser_parse.y"
+#line 134 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy10 = NCDConfig_make_strings(yymsp[0].minor.yy0, 0, NULL);
-    if (!yygotominor.yy10) {
+    yygotominor.yy44 = NCDConfig_make_strings(yymsp[0].minor.yy0, 0, NULL);
+    if (!yygotominor.yy44) {
         parser_out->out_of_memory = 1;
     }
 }
-#line 870 "NCDConfigParser_parse.c"
+#line 866 "NCDConfigParser_parse.c"
         break;
       case 8: /* statement_names ::= NAME DOT statement_names */
-#line 139 "NCDConfigParser_parse.y"
+#line 141 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy10 = NCDConfig_make_strings(yymsp[-2].minor.yy0, 1, yymsp[0].minor.yy10);
-    if (!yygotominor.yy10) {
+    yygotominor.yy44 = NCDConfig_make_strings(yymsp[-2].minor.yy0, 1, yymsp[0].minor.yy44);
+    if (!yygotominor.yy44) {
         parser_out->out_of_memory = 1;
     }
   yy_destructor(yypParser,8,&yymsp[-1].minor);
 }
-#line 881 "NCDConfigParser_parse.c"
+#line 877 "NCDConfigParser_parse.c"
         break;
       case 9: /* statement_args_maybe ::= */
-#line 146 "NCDConfigParser_parse.y"
+#line 148 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy24 = NULL;
+    yygotominor.yy14 = NULL;
 }
-#line 888 "NCDConfigParser_parse.c"
+#line 884 "NCDConfigParser_parse.c"
         break;
       case 10: /* statement_args_maybe ::= list_contents */
-#line 150 "NCDConfigParser_parse.y"
+      case 11: /* list_contents ::= value */ yytestcase(yyruleno==11);
+#line 152 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy24 = yymsp[0].minor.yy24;
+    yygotominor.yy14 = yymsp[0].minor.yy14;
 }
-#line 895 "NCDConfigParser_parse.c"
+#line 892 "NCDConfigParser_parse.c"
         break;
-      case 11: /* list_contents ::= STRING */
-#line 154 "NCDConfigParser_parse.y"
+      case 12: /* list_contents ::= value COMMA list_contents */
+#line 160 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy24 = NCDConfig_make_list_string(yymsp[0].minor.yy0, NULL);
-    if (!yygotominor.yy24) {
-        parser_out->out_of_memory = 1;
+    if (!yymsp[-2].minor.yy14) {
+        NCDConfig_free_list(yymsp[0].minor.yy14);
+    } else {
+        ASSERT(!yymsp[-2].minor.yy14->next)
+        yymsp[-2].minor.yy14->next = yymsp[0].minor.yy14;
     }
+    yygotominor.yy14 = yymsp[-2].minor.yy14;
+  yy_destructor(yypParser,9,&yymsp[-1].minor);
 }
-#line 905 "NCDConfigParser_parse.c"
+#line 906 "NCDConfigParser_parse.c"
         break;
-      case 12: /* list_contents ::= statement_names */
-#line 161 "NCDConfigParser_parse.y"
+      case 13: /* list ::= CURLY_OPEN CURLY_CLOSE */
+#line 170 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy24 = NCDConfig_make_list_var(yymsp[0].minor.yy10, NULL);
-    if (!yygotominor.yy24) {
-        parser_out->out_of_memory = 1;
-    }
+    yygotominor.yy14 = NULL;
+  yy_destructor(yypParser,2,&yymsp[-1].minor);
+  yy_destructor(yypParser,3,&yymsp[0].minor);
 }
 #line 915 "NCDConfigParser_parse.c"
         break;
-      case 13: /* list_contents ::= list */
-#line 168 "NCDConfigParser_parse.y"
+      case 14: /* list ::= CURLY_OPEN list_contents CURLY_CLOSE */
+#line 174 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy24 = NCDConfig_make_list_list(yymsp[0].minor.yy24, NULL);
-    if (!yygotominor.yy24) {
-        parser_out->out_of_memory = 1;
-    }
+    yygotominor.yy14 = yymsp[-1].minor.yy14;
+  yy_destructor(yypParser,2,&yymsp[-2].minor);
+  yy_destructor(yypParser,3,&yymsp[0].minor);
 }
-#line 925 "NCDConfigParser_parse.c"
+#line 924 "NCDConfigParser_parse.c"
         break;
-      case 14: /* list_contents ::= STRING COMMA list_contents */
-#line 175 "NCDConfigParser_parse.y"
+      case 15: /* value ::= STRING */
+#line 178 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy24 = NCDConfig_make_list_string(yymsp[-2].minor.yy0, yymsp[0].minor.yy24);
-    if (!yygotominor.yy24) {
+    yygotominor.yy14 = NCDConfig_make_list_string(yymsp[0].minor.yy0, NULL);
+    if (!yygotominor.yy14) {
         parser_out->out_of_memory = 1;
     }
-  yy_destructor(yypParser,10,&yymsp[-1].minor);
 }
-#line 936 "NCDConfigParser_parse.c"
+#line 934 "NCDConfigParser_parse.c"
         break;
-      case 15: /* list_contents ::= statement_names COMMA list_contents */
-#line 182 "NCDConfigParser_parse.y"
+      case 16: /* value ::= statement_names */
+#line 185 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy24 = NCDConfig_make_list_var(yymsp[-2].minor.yy10, yymsp[0].minor.yy24);
-    if (!yygotominor.yy24) {
+    yygotominor.yy14 = NCDConfig_make_list_var(yymsp[0].minor.yy44, NULL);
+    if (!yygotominor.yy14) {
         parser_out->out_of_memory = 1;
     }
-  yy_destructor(yypParser,10,&yymsp[-1].minor);
 }
-#line 947 "NCDConfigParser_parse.c"
+#line 944 "NCDConfigParser_parse.c"
         break;
-      case 16: /* list_contents ::= list COMMA list_contents */
-#line 189 "NCDConfigParser_parse.y"
+      case 17: /* value ::= list */
+#line 192 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy24 = NCDConfig_make_list_list(yymsp[-2].minor.yy24, yymsp[0].minor.yy24);
-    if (!yygotominor.yy24) {
+    yygotominor.yy14 = NCDConfig_make_list_list(yymsp[0].minor.yy14, NULL);
+    if (!yygotominor.yy14) {
         parser_out->out_of_memory = 1;
     }
-  yy_destructor(yypParser,10,&yymsp[-1].minor);
-}
-#line 958 "NCDConfigParser_parse.c"
-        break;
-      case 17: /* list ::= CURLY_OPEN CURLY_CLOSE */
-#line 196 "NCDConfigParser_parse.y"
-{
-    yygotominor.yy24 = NULL;
-  yy_destructor(yypParser,2,&yymsp[-1].minor);
-  yy_destructor(yypParser,3,&yymsp[0].minor);
 }
-#line 967 "NCDConfigParser_parse.c"
+#line 954 "NCDConfigParser_parse.c"
         break;
-      case 18: /* list ::= CURLY_OPEN list_contents CURLY_CLOSE */
-#line 200 "NCDConfigParser_parse.y"
+      case 18: /* name_maybe ::= */
+#line 199 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy24 = yymsp[-1].minor.yy24;
-  yy_destructor(yypParser,2,&yymsp[-2].minor);
-  yy_destructor(yypParser,3,&yymsp[0].minor);
+    yygotominor.yy1 = NULL;
 }
-#line 976 "NCDConfigParser_parse.c"
+#line 961 "NCDConfigParser_parse.c"
         break;
-      case 19: /* name_maybe ::= */
-#line 204 "NCDConfigParser_parse.y"
+      case 19: /* name_maybe ::= NAME */
+#line 203 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy45 = NULL;
+    yygotominor.yy1 = yymsp[0].minor.yy0;
 }
-#line 983 "NCDConfigParser_parse.c"
+#line 968 "NCDConfigParser_parse.c"
         break;
-      case 20: /* name_maybe ::= NAME */
-#line 208 "NCDConfigParser_parse.y"
+      case 20: /* process_or_template ::= PROCESS */
+#line 207 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy45 = yymsp[0].minor.yy0;
-}
-#line 990 "NCDConfigParser_parse.c"
-        break;
-      case 21: /* process_or_template ::= PROCESS */
-#line 212 "NCDConfigParser_parse.y"
-{
-    yygotominor.yy6 = 0;
+    yygotominor.yy28 = 0;
   yy_destructor(yypParser,11,&yymsp[0].minor);
 }
-#line 998 "NCDConfigParser_parse.c"
+#line 976 "NCDConfigParser_parse.c"
         break;
-      case 22: /* process_or_template ::= TEMPLATE */
-#line 216 "NCDConfigParser_parse.y"
+      case 21: /* process_or_template ::= TEMPLATE */
+#line 211 "NCDConfigParser_parse.y"
 {
-    yygotominor.yy6 = 1;
+    yygotominor.yy28 = 1;
   yy_destructor(yypParser,12,&yymsp[0].minor);
 }
-#line 1006 "NCDConfigParser_parse.c"
+#line 984 "NCDConfigParser_parse.c"
         break;
       default:
         break;
@@ -1064,10 +1042,10 @@ static void yy_syntax_error(
 ){
   ParseARG_FETCH;
 #define TOKEN (yyminor.yy0)
-#line 71 "NCDConfigParser_parse.y"
+#line 73 "NCDConfigParser_parse.y"
 
     parser_out->syntax_error = 1;
-#line 1071 "NCDConfigParser_parse.c"
+#line 1049 "NCDConfigParser_parse.c"
   ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
 }
 

+ 2 - 2
generated/NCDConfigParser_parse.h

@@ -6,7 +6,7 @@
 #define SEMICOLON                       6
 #define ARROW                           7
 #define DOT                             8
-#define STRING                          9
-#define COMMA                          10
+#define COMMA                           9
+#define STRING                         10
 #define PROCESS                        11
 #define TEMPLATE                       12

+ 148 - 196
generated/NCDConfigParser_parse.out

@@ -5,10 +5,10 @@ State 0:
           process_or_template ::= * PROCESS
           process_or_template ::= * TEMPLATE
 
-                       PROCESS shift  31
-                      TEMPLATE shift  32
-                     processes shift  16
-           process_or_template shift  17
+                       PROCESS shift  27
+                      TEMPLATE shift  28
+                     processes shift  14
+           process_or_template shift  15
                          input accept
 
 State 1:
@@ -18,22 +18,22 @@ State 1:
           statement_names ::= * NAME DOT statement_names
       (9) statement_args_maybe ::= *
           statement_args_maybe ::= * list_contents
-          list_contents ::= * STRING
-          list_contents ::= * statement_names
-          list_contents ::= * list
-          list_contents ::= * STRING COMMA list_contents
-          list_contents ::= * statement_names COMMA list_contents
-          list_contents ::= * list COMMA list_contents
+          list_contents ::= * value
+          list_contents ::= * value COMMA list_contents
           list ::= * CURLY_OPEN CURLY_CLOSE
           list ::= * CURLY_OPEN list_contents CURLY_CLOSE
+          value ::= * STRING
+          value ::= * statement_names
+          value ::= * list
 
-                          NAME shift  22
+                          NAME shift  20
                     CURLY_OPEN shift  3
-                        STRING shift  23
-               statement_names shift  24
-          statement_args_maybe shift  20
-                 list_contents shift  36
-                          list shift  25
+                        STRING shift  36
+               statement_names shift  37
+          statement_args_maybe shift  18
+                 list_contents shift  32
+                          list shift  38
+                         value shift  21
                      {default} reduce 9
 
 State 2:
@@ -43,107 +43,67 @@ State 2:
           statement_names ::= * NAME DOT statement_names
       (9) statement_args_maybe ::= *
           statement_args_maybe ::= * list_contents
-          list_contents ::= * STRING
-          list_contents ::= * statement_names
-          list_contents ::= * list
-          list_contents ::= * STRING COMMA list_contents
-          list_contents ::= * statement_names COMMA list_contents
-          list_contents ::= * list COMMA list_contents
+          list_contents ::= * value
+          list_contents ::= * value COMMA list_contents
           list ::= * CURLY_OPEN CURLY_CLOSE
           list ::= * CURLY_OPEN list_contents CURLY_CLOSE
+          value ::= * STRING
+          value ::= * statement_names
+          value ::= * list
 
-                          NAME shift  22
+                          NAME shift  20
                     CURLY_OPEN shift  3
-                        STRING shift  23
-               statement_names shift  24
-          statement_args_maybe shift  28
-                 list_contents shift  36
-                          list shift  25
+                        STRING shift  36
+               statement_names shift  37
+          statement_args_maybe shift  24
+                 list_contents shift  32
+                          list shift  38
+                         value shift  21
                      {default} reduce 9
 
 State 3:
           statement_names ::= * NAME
           statement_names ::= * NAME DOT statement_names
-          list_contents ::= * STRING
-          list_contents ::= * statement_names
-          list_contents ::= * list
-          list_contents ::= * STRING COMMA list_contents
-          list_contents ::= * statement_names COMMA list_contents
-          list_contents ::= * list COMMA list_contents
+          list_contents ::= * value
+          list_contents ::= * value COMMA list_contents
           list ::= * CURLY_OPEN CURLY_CLOSE
           list ::= CURLY_OPEN * CURLY_CLOSE
           list ::= * CURLY_OPEN list_contents CURLY_CLOSE
           list ::= CURLY_OPEN * list_contents CURLY_CLOSE
+          value ::= * STRING
+          value ::= * statement_names
+          value ::= * list
 
-                          NAME shift  22
+                          NAME shift  20
                     CURLY_OPEN shift  3
-                   CURLY_CLOSE shift  38
-                        STRING shift  23
-               statement_names shift  24
-                 list_contents shift  26
-                          list shift  25
+                   CURLY_CLOSE shift  34
+                        STRING shift  36
+               statement_names shift  37
+                 list_contents shift  22
+                          list shift  38
+                         value shift  21
 
 State 4:
           statement_names ::= * NAME
           statement_names ::= * NAME DOT statement_names
-          list_contents ::= * STRING
-          list_contents ::= * statement_names
-          list_contents ::= * list
-          list_contents ::= * STRING COMMA list_contents
-          list_contents ::= STRING COMMA * list_contents
-          list_contents ::= * statement_names COMMA list_contents
-          list_contents ::= * list COMMA list_contents
+          list_contents ::= * value
+          list_contents ::= * value COMMA list_contents
+          list_contents ::= value COMMA * list_contents
           list ::= * CURLY_OPEN CURLY_CLOSE
           list ::= * CURLY_OPEN list_contents CURLY_CLOSE
+          value ::= * STRING
+          value ::= * statement_names
+          value ::= * list
 
-                          NAME shift  22
+                          NAME shift  20
                     CURLY_OPEN shift  3
-                        STRING shift  23
-               statement_names shift  24
-                 list_contents shift  41
-                          list shift  25
+                        STRING shift  36
+               statement_names shift  37
+                 list_contents shift  33
+                          list shift  38
+                         value shift  21
 
 State 5:
-          statement_names ::= * NAME
-          statement_names ::= * NAME DOT statement_names
-          list_contents ::= * STRING
-          list_contents ::= * statement_names
-          list_contents ::= * list
-          list_contents ::= * STRING COMMA list_contents
-          list_contents ::= * statement_names COMMA list_contents
-          list_contents ::= statement_names COMMA * list_contents
-          list_contents ::= * list COMMA list_contents
-          list ::= * CURLY_OPEN CURLY_CLOSE
-          list ::= * CURLY_OPEN list_contents CURLY_CLOSE
-
-                          NAME shift  22
-                    CURLY_OPEN shift  3
-                        STRING shift  23
-               statement_names shift  24
-                 list_contents shift  40
-                          list shift  25
-
-State 6:
-          statement_names ::= * NAME
-          statement_names ::= * NAME DOT statement_names
-          list_contents ::= * STRING
-          list_contents ::= * statement_names
-          list_contents ::= * list
-          list_contents ::= * STRING COMMA list_contents
-          list_contents ::= * statement_names COMMA list_contents
-          list_contents ::= * list COMMA list_contents
-          list_contents ::= list COMMA * list_contents
-          list ::= * CURLY_OPEN CURLY_CLOSE
-          list ::= * CURLY_OPEN list_contents CURLY_CLOSE
-
-                          NAME shift  22
-                    CURLY_OPEN shift  3
-                        STRING shift  23
-               statement_names shift  24
-                 list_contents shift  37
-                          list shift  25
-
-State 7:
           processes ::= * process_or_template NAME CURLY_OPEN statements CURLY_CLOSE
       (1) processes ::= process_or_template NAME CURLY_OPEN statements CURLY_CLOSE *
           processes ::= * process_or_template NAME CURLY_OPEN statements CURLY_CLOSE processes
@@ -151,13 +111,13 @@ State 7:
           process_or_template ::= * PROCESS
           process_or_template ::= * TEMPLATE
 
-                       PROCESS shift  31
-                      TEMPLATE shift  32
-                     processes shift  30
-           process_or_template shift  17
+                       PROCESS shift  27
+                      TEMPLATE shift  28
+                     processes shift  26
+           process_or_template shift  15
                      {default} reduce 1
 
-State 8:
+State 6:
           processes ::= process_or_template NAME CURLY_OPEN * statements CURLY_CLOSE
           processes ::= process_or_template NAME CURLY_OPEN * statements CURLY_CLOSE processes
           statements ::= * statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON
@@ -167,11 +127,11 @@ State 8:
           statement_names ::= * NAME
           statement_names ::= * NAME DOT statement_names
 
-                          NAME shift  22
-                    statements shift  19
-               statement_names shift  15
+                          NAME shift  20
+                    statements shift  17
+               statement_names shift  13
 
-State 9:
+State 7:
           statements ::= * statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON
       (3) statements ::= statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON *
           statements ::= * statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON statements
@@ -181,12 +141,12 @@ State 9:
           statement_names ::= * NAME
           statement_names ::= * NAME DOT statement_names
 
-                          NAME shift  22
-                    statements shift  33
-               statement_names shift  15
+                          NAME shift  20
+                    statements shift  29
+               statement_names shift  13
                      {default} reduce 3
 
-State 10:
+State 8:
           statements ::= * statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON
           statements ::= * statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON statements
           statements ::= * statement_names ARROW statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON
@@ -196,204 +156,195 @@ State 10:
           statement_names ::= * NAME
           statement_names ::= * NAME DOT statement_names
 
-                          NAME shift  22
-                    statements shift  42
-               statement_names shift  15
+                          NAME shift  20
+                    statements shift  39
+               statement_names shift  13
                      {default} reduce 5
 
-State 11:
+State 9:
           statements ::= statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE * name_maybe SEMICOLON
           statements ::= statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE * name_maybe SEMICOLON statements
-     (19) name_maybe ::= *
+     (18) name_maybe ::= *
           name_maybe ::= * NAME
 
-                          NAME shift  35
-                    name_maybe shift  21
-                     {default} reduce 19
+                          NAME shift  31
+                    name_maybe shift  19
+                     {default} reduce 18
 
-State 12:
+State 10:
           statement_names ::= * NAME
           statement_names ::= * NAME DOT statement_names
           statement_names ::= NAME DOT * statement_names
 
-                          NAME shift  22
-               statement_names shift  34
+                          NAME shift  20
+               statement_names shift  30
 
-State 13:
+State 11:
           statements ::= statement_names ARROW * statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON
           statements ::= statement_names ARROW * statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON statements
           statement_names ::= * NAME
           statement_names ::= * NAME DOT statement_names
 
-                          NAME shift  22
-               statement_names shift  27
+                          NAME shift  20
+               statement_names shift  23
 
-State 14:
+State 12:
           statements ::= statement_names ARROW statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE * name_maybe SEMICOLON
           statements ::= statement_names ARROW statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE * name_maybe SEMICOLON statements
-     (19) name_maybe ::= *
+     (18) name_maybe ::= *
           name_maybe ::= * NAME
 
-                          NAME shift  35
-                    name_maybe shift  29
-                     {default} reduce 19
+                          NAME shift  31
+                    name_maybe shift  25
+                     {default} reduce 18
 
-State 15:
+State 13:
           statements ::= statement_names * ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON
           statements ::= statement_names * ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON statements
           statements ::= statement_names * ARROW statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON
           statements ::= statement_names * ARROW statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON statements
 
                     ROUND_OPEN shift  1
-                         ARROW shift  13
+                         ARROW shift  11
 
-State 16:
+State 14:
       (0) input ::= processes *
 
                              $ reduce 0
 
-State 17:
+State 15:
           processes ::= process_or_template * NAME CURLY_OPEN statements CURLY_CLOSE
           processes ::= process_or_template * NAME CURLY_OPEN statements CURLY_CLOSE processes
 
-                          NAME shift  18
+                          NAME shift  16
 
-State 18:
+State 16:
           processes ::= process_or_template NAME * CURLY_OPEN statements CURLY_CLOSE
           processes ::= process_or_template NAME * CURLY_OPEN statements CURLY_CLOSE processes
 
-                    CURLY_OPEN shift  8
+                    CURLY_OPEN shift  6
 
-State 19:
+State 17:
           processes ::= process_or_template NAME CURLY_OPEN statements * CURLY_CLOSE
           processes ::= process_or_template NAME CURLY_OPEN statements * CURLY_CLOSE processes
 
-                   CURLY_CLOSE shift  7
+                   CURLY_CLOSE shift  5
 
-State 20:
+State 18:
           statements ::= statement_names ROUND_OPEN statement_args_maybe * ROUND_CLOSE name_maybe SEMICOLON
           statements ::= statement_names ROUND_OPEN statement_args_maybe * ROUND_CLOSE name_maybe SEMICOLON statements
 
-                   ROUND_CLOSE shift  11
+                   ROUND_CLOSE shift  9
 
-State 21:
+State 19:
           statements ::= statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe * SEMICOLON
           statements ::= statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe * SEMICOLON statements
 
-                     SEMICOLON shift  9
+                     SEMICOLON shift  7
 
-State 22:
+State 20:
       (7) statement_names ::= NAME *
           statement_names ::= NAME * DOT statement_names
 
-                           DOT shift  12
+                           DOT shift  10
                      {default} reduce 7
 
-State 23:
-     (11) list_contents ::= STRING *
-          list_contents ::= STRING * COMMA list_contents
+State 21:
+     (11) list_contents ::= value *
+          list_contents ::= value * COMMA list_contents
 
                          COMMA shift  4
                      {default} reduce 11
 
-State 24:
-     (12) list_contents ::= statement_names *
-          list_contents ::= statement_names * COMMA list_contents
-
-                         COMMA shift  5
-                     {default} reduce 12
-
-State 25:
-     (13) list_contents ::= list *
-          list_contents ::= list * COMMA list_contents
-
-                         COMMA shift  6
-                     {default} reduce 13
-
-State 26:
+State 22:
           list ::= CURLY_OPEN list_contents * CURLY_CLOSE
 
-                   CURLY_CLOSE shift  39
+                   CURLY_CLOSE shift  35
 
-State 27:
+State 23:
           statements ::= statement_names ARROW statement_names * ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON
           statements ::= statement_names ARROW statement_names * ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON statements
 
                     ROUND_OPEN shift  2
 
-State 28:
+State 24:
           statements ::= statement_names ARROW statement_names ROUND_OPEN statement_args_maybe * ROUND_CLOSE name_maybe SEMICOLON
           statements ::= statement_names ARROW statement_names ROUND_OPEN statement_args_maybe * ROUND_CLOSE name_maybe SEMICOLON statements
 
-                   ROUND_CLOSE shift  14
+                   ROUND_CLOSE shift  12
 
-State 29:
+State 25:
           statements ::= statement_names ARROW statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe * SEMICOLON
           statements ::= statement_names ARROW statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe * SEMICOLON statements
 
-                     SEMICOLON shift  10
+                     SEMICOLON shift  8
 
-State 30:
+State 26:
       (2) processes ::= process_or_template NAME CURLY_OPEN statements CURLY_CLOSE processes *
 
                      {default} reduce 2
 
-State 31:
-     (21) process_or_template ::= PROCESS *
+State 27:
+     (20) process_or_template ::= PROCESS *
 
-                     {default} reduce 21
+                     {default} reduce 20
 
-State 32:
-     (22) process_or_template ::= TEMPLATE *
+State 28:
+     (21) process_or_template ::= TEMPLATE *
 
-                     {default} reduce 22
+                     {default} reduce 21
 
-State 33:
+State 29:
       (4) statements ::= statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON statements *
 
                      {default} reduce 4
 
-State 34:
+State 30:
       (8) statement_names ::= NAME DOT statement_names *
 
                      {default} reduce 8
 
-State 35:
-     (20) name_maybe ::= NAME *
+State 31:
+     (19) name_maybe ::= NAME *
 
-                     {default} reduce 20
+                     {default} reduce 19
 
-State 36:
+State 32:
      (10) statement_args_maybe ::= list_contents *
 
                      {default} reduce 10
 
-State 37:
-     (16) list_contents ::= list COMMA list_contents *
+State 33:
+     (12) list_contents ::= value COMMA list_contents *
 
-                     {default} reduce 16
+                     {default} reduce 12
 
-State 38:
-     (17) list ::= CURLY_OPEN CURLY_CLOSE *
+State 34:
+     (13) list ::= CURLY_OPEN CURLY_CLOSE *
 
-                     {default} reduce 17
+                     {default} reduce 13
 
-State 39:
-     (18) list ::= CURLY_OPEN list_contents CURLY_CLOSE *
+State 35:
+     (14) list ::= CURLY_OPEN list_contents CURLY_CLOSE *
 
-                     {default} reduce 18
+                     {default} reduce 14
 
-State 40:
-     (15) list_contents ::= statement_names COMMA list_contents *
+State 36:
+     (15) value ::= STRING *
 
                      {default} reduce 15
 
-State 41:
-     (14) list_contents ::= STRING COMMA list_contents *
+State 37:
+     (16) value ::= statement_names *
 
-                     {default} reduce 14
+                     {default} reduce 16
+
+State 38:
+     (17) value ::= list *
 
-State 42:
+                     {default} reduce 17
+
+State 39:
       (6) statements ::= statement_names ARROW statement_names ROUND_OPEN statement_args_maybe ROUND_CLOSE name_maybe SEMICOLON statements *
 
                      {default} reduce 6
@@ -409,8 +360,8 @@ Symbols:
     6: SEMICOLON
     7: ARROW
     8: DOT
-    9: STRING
-   10: COMMA
+    9: COMMA
+   10: STRING
    11: PROCESS
    12: TEMPLATE
    13: error:
@@ -420,6 +371,7 @@ Symbols:
    17: statement_args_maybe: <lambda> NAME CURLY_OPEN STRING
    18: list_contents: NAME CURLY_OPEN STRING
    19: list: CURLY_OPEN
-   20: name_maybe: <lambda> NAME
-   21: process_or_template: PROCESS TEMPLATE
-   22: input: PROCESS TEMPLATE
+   20: value: NAME CURLY_OPEN STRING
+   21: name_maybe: <lambda> NAME
+   22: process_or_template: PROCESS TEMPLATE
+   23: input: PROCESS TEMPLATE

+ 23 - 28
generated/NCDConfigParser_parse.y

@@ -55,6 +55,7 @@ struct parser_out {
 %type statement_args_maybe {struct NCDConfig_list *}
 %type list_contents {struct NCDConfig_list *}
 %type list {struct NCDConfig_list *}
+%type value {struct NCDConfig_list *}
 %type name_maybe {char *}
 %type process_or_template {int}
 
@@ -64,6 +65,7 @@ struct parser_out {
 %destructor statement_args_maybe { NCDConfig_free_list($$); }
 %destructor list_contents { NCDConfig_free_list($$); }
 %destructor list { NCDConfig_free_list($$); }
+%destructor value { NCDConfig_free_list($$); }
 %destructor name_maybe { free($$); }
 
 %stack_size 0
@@ -151,56 +153,49 @@ statement_args_maybe(R) ::= list_contents(A). {
     R = A;
 }
 
-list_contents(R) ::= STRING(A). {
-    R = NCDConfig_make_list_string(A, NULL);
-    if (!R) {
-        parser_out->out_of_memory = 1;
-    }
+list_contents(R) ::= value(A). {
+    R = A;
 }
 
-list_contents(R) ::= statement_names(A). {
-    R = NCDConfig_make_list_var(A, NULL);
-    if (!R) {
-        parser_out->out_of_memory = 1;
+list_contents(R) ::= value(A) COMMA list_contents(N). {
+    if (!A) {
+        NCDConfig_free_list(N);
+    } else {
+        ASSERT(!A->next)
+        A->next = N;
     }
+    R = A;
 }
 
-list_contents(R) ::= list(A). {
-    R = NCDConfig_make_list_list(A, NULL);
-    if (!R) {
-        parser_out->out_of_memory = 1;
-    }
+list(R) ::= CURLY_OPEN CURLY_CLOSE. {
+    R = NULL;
 }
 
-list_contents(R) ::= STRING(A) COMMA list_contents(N). {
-    R = NCDConfig_make_list_string(A, N);
+list(R) ::= CURLY_OPEN list_contents(A) CURLY_CLOSE. {
+    R = A;
+}
+
+value(R) ::= STRING(A). {
+    R = NCDConfig_make_list_string(A, NULL);
     if (!R) {
         parser_out->out_of_memory = 1;
     }
 }
 
-list_contents(R) ::= statement_names(A) COMMA list_contents(N). {
-    R = NCDConfig_make_list_var(A, N);
+value(R) ::= statement_names(A). {
+    R = NCDConfig_make_list_var(A, NULL);
     if (!R) {
         parser_out->out_of_memory = 1;
     }
 }
 
-list_contents(R) ::= list(A) COMMA list_contents(N). {
-    R = NCDConfig_make_list_list(A, N);
+value(R) ::= list(A). {
+    R = NCDConfig_make_list_list(A, NULL);
     if (!R) {
         parser_out->out_of_memory = 1;
     }
 }
 
-list(R) ::= CURLY_OPEN CURLY_CLOSE. {
-    R = NULL;
-}
-
-list(R) ::= CURLY_OPEN list_contents(A) CURLY_CLOSE. {
-    R = A;
-}
-
 name_maybe(R) ::= . {
     R = NULL;
 }

+ 23 - 28
ncd/NCDConfigParser_parse.y

@@ -55,6 +55,7 @@ struct parser_out {
 %type statement_args_maybe {struct NCDConfig_list *}
 %type list_contents {struct NCDConfig_list *}
 %type list {struct NCDConfig_list *}
+%type value {struct NCDConfig_list *}
 %type name_maybe {char *}
 %type process_or_template {int}
 
@@ -64,6 +65,7 @@ struct parser_out {
 %destructor statement_args_maybe { NCDConfig_free_list($$); }
 %destructor list_contents { NCDConfig_free_list($$); }
 %destructor list { NCDConfig_free_list($$); }
+%destructor value { NCDConfig_free_list($$); }
 %destructor name_maybe { free($$); }
 
 %stack_size 0
@@ -151,56 +153,49 @@ statement_args_maybe(R) ::= list_contents(A). {
     R = A;
 }
 
-list_contents(R) ::= STRING(A). {
-    R = NCDConfig_make_list_string(A, NULL);
-    if (!R) {
-        parser_out->out_of_memory = 1;
-    }
+list_contents(R) ::= value(A). {
+    R = A;
 }
 
-list_contents(R) ::= statement_names(A). {
-    R = NCDConfig_make_list_var(A, NULL);
-    if (!R) {
-        parser_out->out_of_memory = 1;
+list_contents(R) ::= value(A) COMMA list_contents(N). {
+    if (!A) {
+        NCDConfig_free_list(N);
+    } else {
+        ASSERT(!A->next)
+        A->next = N;
     }
+    R = A;
 }
 
-list_contents(R) ::= list(A). {
-    R = NCDConfig_make_list_list(A, NULL);
-    if (!R) {
-        parser_out->out_of_memory = 1;
-    }
+list(R) ::= CURLY_OPEN CURLY_CLOSE. {
+    R = NULL;
 }
 
-list_contents(R) ::= STRING(A) COMMA list_contents(N). {
-    R = NCDConfig_make_list_string(A, N);
+list(R) ::= CURLY_OPEN list_contents(A) CURLY_CLOSE. {
+    R = A;
+}
+
+value(R) ::= STRING(A). {
+    R = NCDConfig_make_list_string(A, NULL);
     if (!R) {
         parser_out->out_of_memory = 1;
     }
 }
 
-list_contents(R) ::= statement_names(A) COMMA list_contents(N). {
-    R = NCDConfig_make_list_var(A, N);
+value(R) ::= statement_names(A). {
+    R = NCDConfig_make_list_var(A, NULL);
     if (!R) {
         parser_out->out_of_memory = 1;
     }
 }
 
-list_contents(R) ::= list(A) COMMA list_contents(N). {
-    R = NCDConfig_make_list_list(A, N);
+value(R) ::= list(A). {
+    R = NCDConfig_make_list_list(A, NULL);
     if (!R) {
         parser_out->out_of_memory = 1;
     }
 }
 
-list(R) ::= CURLY_OPEN CURLY_CLOSE. {
-    R = NULL;
-}
-
-list(R) ::= CURLY_OPEN list_contents(A) CURLY_CLOSE. {
-    R = A;
-}
-
 name_maybe(R) ::= . {
     R = NULL;
 }