diff options
Diffstat (limited to '3rdparty/libconfig/grammar.c')
-rw-r--r-- | 3rdparty/libconfig/grammar.c | 331 |
1 files changed, 185 insertions, 146 deletions
diff --git a/3rdparty/libconfig/grammar.c b/3rdparty/libconfig/grammar.c index 9e7e298f0..da528ee20 100644 --- a/3rdparty/libconfig/grammar.c +++ b/3rdparty/libconfig/grammar.c @@ -159,24 +159,26 @@ extern int libconfig_yydebug; TOK_INTEGER = 259, TOK_HEX = 260, TOK_BIN = 261, - TOK_INTEGER64 = 262, - TOK_HEX64 = 263, - TOK_BIN64 = 264, - TOK_FLOAT = 265, - TOK_STRING = 266, - TOK_NAME = 267, - TOK_EQUALS = 268, - TOK_NEWLINE = 269, - TOK_ARRAY_START = 270, - TOK_ARRAY_END = 271, - TOK_LIST_START = 272, - TOK_LIST_END = 273, - TOK_COMMA = 274, - TOK_GROUP_START = 275, - TOK_GROUP_END = 276, - TOK_SEMICOLON = 277, - TOK_GARBAGE = 278, - TOK_ERROR = 279 + TOK_OCT = 262, + TOK_INTEGER64 = 263, + TOK_HEX64 = 264, + TOK_BIN64 = 265, + TOK_OCT64 = 266, + TOK_FLOAT = 267, + TOK_STRING = 268, + TOK_NAME = 269, + TOK_EQUALS = 270, + TOK_NEWLINE = 271, + TOK_ARRAY_START = 272, + TOK_ARRAY_END = 273, + TOK_LIST_START = 274, + TOK_LIST_END = 275, + TOK_COMMA = 276, + TOK_GROUP_START = 277, + TOK_GROUP_END = 278, + TOK_SEMICOLON = 279, + TOK_GARBAGE = 280, + TOK_ERROR = 281 }; #endif /* Tokens. */ @@ -184,24 +186,26 @@ extern int libconfig_yydebug; #define TOK_INTEGER 259 #define TOK_HEX 260 #define TOK_BIN 261 -#define TOK_INTEGER64 262 -#define TOK_HEX64 263 -#define TOK_BIN64 264 -#define TOK_FLOAT 265 -#define TOK_STRING 266 -#define TOK_NAME 267 -#define TOK_EQUALS 268 -#define TOK_NEWLINE 269 -#define TOK_ARRAY_START 270 -#define TOK_ARRAY_END 271 -#define TOK_LIST_START 272 -#define TOK_LIST_END 273 -#define TOK_COMMA 274 -#define TOK_GROUP_START 275 -#define TOK_GROUP_END 276 -#define TOK_SEMICOLON 277 -#define TOK_GARBAGE 278 -#define TOK_ERROR 279 +#define TOK_OCT 262 +#define TOK_INTEGER64 263 +#define TOK_HEX64 264 +#define TOK_BIN64 265 +#define TOK_OCT64 266 +#define TOK_FLOAT 267 +#define TOK_STRING 268 +#define TOK_NAME 269 +#define TOK_EQUALS 270 +#define TOK_NEWLINE 271 +#define TOK_ARRAY_START 272 +#define TOK_ARRAY_END 273 +#define TOK_LIST_START 274 +#define TOK_LIST_END 275 +#define TOK_COMMA 276 +#define TOK_GROUP_START 277 +#define TOK_GROUP_END 278 +#define TOK_SEMICOLON 279 +#define TOK_GARBAGE 280 +#define TOK_ERROR 281 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED @@ -215,7 +219,7 @@ union YYSTYPE double fval; char *sval; -#line 219 "grammar.c" /* yacc.c:355 */ +#line 223 "grammar.c" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; @@ -231,7 +235,7 @@ int libconfig_yyparse (void *scanner, struct parse_context *ctx, struct scan_con /* Copy the second part of user declarations. */ -#line 235 "grammar.c" /* yacc.c:358 */ +#line 239 "grammar.c" /* yacc.c:358 */ #ifdef short # undef short @@ -473,21 +477,21 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 6 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 40 +#define YYLAST 52 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 25 +#define YYNTOKENS 27 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 23 /* YYNRULES -- Number of rules. */ -#define YYNRULES 45 +#define YYNRULES 47 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 53 +#define YYNSTATES 55 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 279 +#define YYMAXUTOK 281 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -523,7 +527,8 @@ static const yytype_uint8 yytranslate[] = 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, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26 }; #if YYDEBUG @@ -533,8 +538,8 @@ static const yytype_uint16 yyrline[] = 0, 101, 101, 103, 107, 108, 111, 113, 116, 118, 119, 122, 124, 129, 128, 148, 147, 171, 170, 193, 194, 195, 196, 200, 201, 205, 225, 247, 269, 291, - 313, 335, 357, 375, 403, 404, 408, 411, 413, 417, - 418, 422, 425, 427, 432, 431 + 313, 330, 347, 364, 381, 399, 427, 428, 432, 435, + 437, 441, 442, 446, 449, 451, 456, 455 }; #endif @@ -544,15 +549,15 @@ static const yytype_uint16 yyrline[] = static const char *const yytname[] = { "$end", "error", "$undefined", "TOK_BOOLEAN", "TOK_INTEGER", "TOK_HEX", - "TOK_BIN", "TOK_INTEGER64", "TOK_HEX64", "TOK_BIN64", "TOK_FLOAT", - "TOK_STRING", "TOK_NAME", "TOK_EQUALS", "TOK_NEWLINE", "TOK_ARRAY_START", - "TOK_ARRAY_END", "TOK_LIST_START", "TOK_LIST_END", "TOK_COMMA", - "TOK_GROUP_START", "TOK_GROUP_END", "TOK_SEMICOLON", "TOK_GARBAGE", - "TOK_ERROR", "$accept", "configuration", "setting_list", - "setting_list_optional", "setting_terminator", "comma_optional", - "setting", "$@1", "array", "$@2", "list", "$@3", "value", "string", - "simple_value", "value_list_sub", "value_list", "value_list_optional", - "simple_value_list_sub", "simple_value_list", + "TOK_BIN", "TOK_OCT", "TOK_INTEGER64", "TOK_HEX64", "TOK_BIN64", + "TOK_OCT64", "TOK_FLOAT", "TOK_STRING", "TOK_NAME", "TOK_EQUALS", + "TOK_NEWLINE", "TOK_ARRAY_START", "TOK_ARRAY_END", "TOK_LIST_START", + "TOK_LIST_END", "TOK_COMMA", "TOK_GROUP_START", "TOK_GROUP_END", + "TOK_SEMICOLON", "TOK_GARBAGE", "TOK_ERROR", "$accept", "configuration", + "setting_list", "setting_list_optional", "setting_terminator", + "comma_optional", "setting", "$@1", "array", "$@2", "list", "$@3", + "value", "string", "simple_value", "value_list_sub", "value_list", + "value_list_optional", "simple_value_list_sub", "simple_value_list", "simple_value_list_optional", "group", "$@4", YY_NULLPTR }; #endif @@ -564,14 +569,14 @@ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279 + 275, 276, 277, 278, 279, 280, 281 }; # endif -#define YYPACT_NINF -28 +#define YYPACT_NINF -19 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-28))) + (!!((Yystate) == (-19))) #define YYTABLE_NINF -1 @@ -582,12 +587,12 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int8 yypact[] = { - 1, -28, 17, 1, -28, 5, -28, -28, -1, -28, - -28, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -7, 10, -28, -28, 26, -1, 1, - -28, -28, -28, -28, -28, 3, -28, 7, -28, 6, - -28, 8, 1, 19, 26, -28, -28, -1, -28, -28, - -28, -28, -28 + 0, -19, 18, 0, -19, 6, -19, -19, -2, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -5, 9, -19, -19, 39, + -2, 0, -19, -19, -19, -19, -19, 2, -19, 7, + -19, 3, -19, 8, 0, 4, 39, -19, -19, -2, + -19, -19, -19, -19, -19 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -596,27 +601,27 @@ static const yytype_int8 yypact[] = static const yytype_uint8 yydefact[] = { 2, 13, 0, 3, 4, 0, 1, 5, 0, 25, - 26, 28, 30, 27, 29, 31, 32, 23, 15, 17, - 44, 20, 21, 8, 33, 19, 22, 42, 37, 6, - 10, 9, 14, 24, 39, 11, 43, 0, 34, 11, - 38, 0, 7, 0, 12, 41, 16, 12, 36, 18, - 45, 40, 35 + 26, 28, 30, 32, 27, 29, 31, 33, 34, 23, + 15, 17, 46, 20, 21, 8, 35, 19, 22, 44, + 39, 6, 10, 9, 14, 24, 41, 11, 45, 0, + 36, 11, 40, 0, 7, 0, 12, 43, 16, 12, + 38, 18, 47, 42, 37 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -28, -28, -5, -28, -28, -12, -3, -28, -28, -28, - -28, -28, -27, -28, -16, -28, -28, -28, -28, -28, - -28, -28, -28 + -19, -19, 1, -19, -19, -15, -3, -19, -19, -19, + -19, -19, -18, -19, -16, -19, -19, -19, -19, -19, + -19, -19, -19 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 2, 3, 43, 32, 45, 4, 5, 21, 27, - 22, 28, 23, 24, 25, 39, 40, 41, 35, 36, - 37, 26, 29 + -1, 2, 3, 45, 34, 47, 4, 5, 23, 29, + 24, 30, 25, 26, 27, 41, 42, 43, 37, 38, + 39, 28, 31 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -624,42 +629,44 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { - 7, 38, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 34, 30, 1, 18, 31, 19, 6, 8, 20, - 52, 33, 44, 46, 42, 47, 49, 48, 51, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 0, 7, - 50 + 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 40, 36, 1, 20, 32, 21, 6, 33, + 22, 8, 35, 46, 49, 48, 50, 52, 51, 0, + 53, 54, 44, 0, 0, 0, 0, 0, 0, 0, + 0, 7, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19 }; static const yytype_int8 yycheck[] = { - 3, 28, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 27, 19, 12, 15, 22, 17, 0, 13, 20, - 47, 11, 19, 16, 29, 19, 18, 39, 44, 3, - 4, 5, 6, 7, 8, 9, 10, 11, -1, 42, - 21 + 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 30, 29, 14, 17, 21, 19, 0, 24, + 22, 15, 13, 21, 21, 18, 41, 23, 20, -1, + 46, 49, 31, -1, -1, -1, -1, -1, -1, -1, + -1, 44, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 12, 26, 27, 31, 32, 0, 31, 13, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 15, 17, - 20, 33, 35, 37, 38, 39, 46, 34, 36, 47, - 19, 22, 29, 11, 39, 43, 44, 45, 37, 40, - 41, 42, 27, 28, 19, 30, 16, 19, 30, 18, - 21, 39, 37 + 0, 14, 28, 29, 33, 34, 0, 33, 15, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 17, 19, 22, 35, 37, 39, 40, 41, 48, 36, + 38, 49, 21, 24, 31, 13, 41, 45, 46, 47, + 39, 42, 43, 44, 29, 30, 21, 32, 18, 21, + 32, 20, 23, 41, 39 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 25, 26, 26, 27, 27, 28, 28, 29, 29, - 29, 30, 30, 32, 31, 34, 33, 36, 35, 37, - 37, 37, 37, 38, 38, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 40, 40, 41, 42, 42, 43, - 43, 44, 45, 45, 47, 46 + 0, 27, 28, 28, 29, 29, 30, 30, 31, 31, + 31, 32, 32, 34, 33, 36, 35, 38, 37, 39, + 39, 39, 39, 40, 40, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 42, 42, 43, 44, + 44, 45, 45, 46, 47, 47, 49, 48 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ @@ -668,8 +675,8 @@ static const yytype_uint8 yyr2[] = 0, 2, 0, 1, 1, 2, 0, 1, 0, 1, 1, 0, 1, 0, 5, 0, 4, 0, 4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 2, 0, 1, 1, - 3, 2, 0, 1, 0, 4 + 1, 1, 1, 1, 1, 1, 1, 3, 2, 0, + 1, 1, 3, 2, 0, 1, 0, 4 }; @@ -1368,7 +1375,7 @@ yyreduce: CAPTURE_PARSE_POS(ctx->setting); } } -#line 1374 "grammar.c" /* yacc.c:1646 */ +#line 1381 "grammar.c" /* yacc.c:1646 */ break; case 15: @@ -1386,7 +1393,7 @@ yyreduce: ctx->setting = NULL; } } -#line 1392 "grammar.c" /* yacc.c:1646 */ +#line 1399 "grammar.c" /* yacc.c:1646 */ break; case 16: @@ -1395,7 +1402,7 @@ yyreduce: if(ctx->parent) ctx->parent = ctx->parent->parent; } -#line 1401 "grammar.c" /* yacc.c:1646 */ +#line 1408 "grammar.c" /* yacc.c:1646 */ break; case 17: @@ -1413,7 +1420,7 @@ yyreduce: ctx->setting = NULL; } } -#line 1419 "grammar.c" /* yacc.c:1646 */ +#line 1426 "grammar.c" /* yacc.c:1646 */ break; case 18: @@ -1422,19 +1429,19 @@ yyreduce: if(ctx->parent) ctx->parent = ctx->parent->parent; } -#line 1428 "grammar.c" /* yacc.c:1646 */ +#line 1435 "grammar.c" /* yacc.c:1646 */ break; case 23: #line 200 "grammar.y" /* yacc.c:1646 */ { parsectx_append_string(ctx, (yyvsp[0].sval)); free((yyvsp[0].sval)); } -#line 1434 "grammar.c" /* yacc.c:1646 */ +#line 1441 "grammar.c" /* yacc.c:1646 */ break; case 24: #line 201 "grammar.y" /* yacc.c:1646 */ { parsectx_append_string(ctx, (yyvsp[0].sval)); free((yyvsp[0].sval)); } -#line 1440 "grammar.c" /* yacc.c:1646 */ +#line 1447 "grammar.c" /* yacc.c:1646 */ break; case 25: @@ -1458,7 +1465,7 @@ yyreduce: else config_setting_set_bool(ctx->setting, (int)(yyvsp[0].ival)); } -#line 1464 "grammar.c" /* yacc.c:1646 */ +#line 1471 "grammar.c" /* yacc.c:1646 */ break; case 26: @@ -1484,7 +1491,7 @@ yyreduce: config_setting_set_format(ctx->setting, CONFIG_FORMAT_DEFAULT); } } -#line 1490 "grammar.c" /* yacc.c:1646 */ +#line 1497 "grammar.c" /* yacc.c:1646 */ break; case 27: @@ -1510,7 +1517,7 @@ yyreduce: config_setting_set_format(ctx->setting, CONFIG_FORMAT_DEFAULT); } } -#line 1516 "grammar.c" /* yacc.c:1646 */ +#line 1523 "grammar.c" /* yacc.c:1646 */ break; case 28: @@ -1536,7 +1543,7 @@ yyreduce: config_setting_set_format(ctx->setting, CONFIG_FORMAT_HEX); } } -#line 1542 "grammar.c" /* yacc.c:1646 */ +#line 1549 "grammar.c" /* yacc.c:1646 */ break; case 29: @@ -1562,63 +1569,95 @@ yyreduce: config_setting_set_format(ctx->setting, CONFIG_FORMAT_HEX); } } -#line 1568 "grammar.c" /* yacc.c:1646 */ +#line 1575 "grammar.c" /* yacc.c:1646 */ break; case 30: #line 314 "grammar.y" /* yacc.c:1646 */ { - if(IN_ARRAY() || IN_LIST()) - { + if (IN_ARRAY() || IN_LIST()) { struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[0].ival)); - if(! e) - { + + if (!e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); YYABORT; - } - else - { + } else { config_setting_set_format(e, CONFIG_FORMAT_BIN); CAPTURE_PARSE_POS(e); } - } - else - { + } else { config_setting_set_int(ctx->setting, (yyvsp[0].ival)); config_setting_set_format(ctx->setting, CONFIG_FORMAT_BIN); } } -#line 1594 "grammar.c" /* yacc.c:1646 */ +#line 1596 "grammar.c" /* yacc.c:1646 */ break; case 31: -#line 336 "grammar.y" /* yacc.c:1646 */ - { - if(IN_ARRAY() || IN_LIST()) +#line 331 "grammar.y" /* yacc.c:1646 */ { + if (IN_ARRAY() || IN_LIST()) { struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[0].llval)); - if(! e) - { + + if (!e) { libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); YYABORT; - } - else - { + } else { config_setting_set_format(e, CONFIG_FORMAT_BIN); CAPTURE_PARSE_POS(e); } - } - else - { + } else { config_setting_set_int64(ctx->setting, (yyvsp[0].llval)); config_setting_set_format(ctx->setting, CONFIG_FORMAT_BIN); } } -#line 1620 "grammar.c" /* yacc.c:1646 */ +#line 1617 "grammar.c" /* yacc.c:1646 */ break; case 32: -#line 358 "grammar.y" /* yacc.c:1646 */ +#line 348 "grammar.y" /* yacc.c:1646 */ + { + if (IN_ARRAY() || IN_LIST()) { + struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, (yyvsp[0].ival)); + + if (!e) { + libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); + YYABORT; + } else { + config_setting_set_format(e, CONFIG_FORMAT_OCT); + CAPTURE_PARSE_POS(e); + } + } else { + config_setting_set_int(ctx->setting, (yyvsp[0].ival)); + config_setting_set_format(ctx->setting, CONFIG_FORMAT_OCT); + } + } +#line 1638 "grammar.c" /* yacc.c:1646 */ + break; + + case 33: +#line 365 "grammar.y" /* yacc.c:1646 */ + { + if (IN_ARRAY() || IN_LIST()) { + struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, (yyvsp[0].llval)); + + if (!e) { + libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); + YYABORT; + } else { + config_setting_set_format(e, CONFIG_FORMAT_OCT); + CAPTURE_PARSE_POS(e); + } + } else { + config_setting_set_int64(ctx->setting, (yyvsp[0].llval)); + config_setting_set_format(ctx->setting, CONFIG_FORMAT_OCT); + } + } +#line 1659 "grammar.c" /* yacc.c:1646 */ + break; + + case 34: +#line 382 "grammar.y" /* yacc.c:1646 */ { if(IN_ARRAY() || IN_LIST()) { @@ -1636,11 +1675,11 @@ yyreduce: else config_setting_set_float(ctx->setting, (yyvsp[0].fval)); } -#line 1642 "grammar.c" /* yacc.c:1646 */ +#line 1681 "grammar.c" /* yacc.c:1646 */ break; - case 33: -#line 376 "grammar.y" /* yacc.c:1646 */ + case 35: +#line 400 "grammar.y" /* yacc.c:1646 */ { if(IN_ARRAY() || IN_LIST()) { @@ -1665,11 +1704,11 @@ yyreduce: _delete(s); } } -#line 1671 "grammar.c" /* yacc.c:1646 */ +#line 1710 "grammar.c" /* yacc.c:1646 */ break; - case 44: -#line 432 "grammar.y" /* yacc.c:1646 */ + case 46: +#line 456 "grammar.y" /* yacc.c:1646 */ { if(IN_LIST()) { @@ -1683,20 +1722,20 @@ yyreduce: ctx->setting = NULL; } } -#line 1689 "grammar.c" /* yacc.c:1646 */ +#line 1728 "grammar.c" /* yacc.c:1646 */ break; - case 45: -#line 447 "grammar.y" /* yacc.c:1646 */ + case 47: +#line 471 "grammar.y" /* yacc.c:1646 */ { if(ctx->parent) ctx->parent = ctx->parent->parent; } -#line 1698 "grammar.c" /* yacc.c:1646 */ +#line 1737 "grammar.c" /* yacc.c:1646 */ break; -#line 1702 "grammar.c" /* yacc.c:1646 */ +#line 1741 "grammar.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1924,5 +1963,5 @@ yyreturn: #endif return yyresult; } -#line 453 "grammar.y" /* yacc.c:1906 */ +#line 477 "grammar.y" /* yacc.c:1906 */ |