diff options
author | Jedzkie <jedzkie13@rocketmail.com> | 2020-06-23 08:00:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 08:00:00 +0800 |
commit | 520863eaeda83da14b88d09f6378cd8abd5a5174 (patch) | |
tree | 2496ea36744dc2f51d264741a78699e719ceeb3b /3rdparty/libconfig/extra/gen/grammar.y | |
parent | 0b7768837bed2aa521de5b9b76b2348943d7db20 (diff) | |
parent | 9b89425550094f51d633e5b5d6e86af65bffbf39 (diff) | |
download | hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.tar.gz hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.tar.bz2 hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.tar.xz hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.zip |
Merge branch 'master' into jedzkie-pr03
Diffstat (limited to '3rdparty/libconfig/extra/gen/grammar.y')
-rw-r--r-- | 3rdparty/libconfig/extra/gen/grammar.y | 72 |
1 files changed, 70 insertions, 2 deletions
diff --git a/3rdparty/libconfig/extra/gen/grammar.y b/3rdparty/libconfig/extra/gen/grammar.y index 5d9f02c2d..b02612435 100644 --- a/3rdparty/libconfig/extra/gen/grammar.y +++ b/3rdparty/libconfig/extra/gen/grammar.y @@ -90,8 +90,8 @@ void libconfig_yyerror(void *scanner, struct parse_context *ctx, char *sval; } -%token <ival> TOK_BOOLEAN TOK_INTEGER TOK_HEX -%token <llval> TOK_INTEGER64 TOK_HEX64 +%token <ival> TOK_BOOLEAN TOK_INTEGER TOK_HEX TOK_BIN TOK_OCT +%token <llval> TOK_INTEGER64 TOK_HEX64 TOK_BIN64 TOK_OCT64 %token <fval> TOK_FLOAT %token <sval> TOK_STRING TOK_NAME %token 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 @@ -310,6 +310,74 @@ simple_value: config_setting_set_format(ctx->setting, CONFIG_FORMAT_HEX); } } + | TOK_BIN + { + if (IN_ARRAY() || IN_LIST()) { + struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, $1); + + if (e == NULL) { + libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); + YYABORT; + } else { + config_setting_set_format(e, CONFIG_FORMAT_BIN); + CAPTURE_PARSE_POS(e); + } + } else { + config_setting_set_int(ctx->setting, $1); + config_setting_set_format(ctx->setting, CONFIG_FORMAT_BIN); + } + } + | TOK_BIN64 + { + if (IN_ARRAY() || IN_LIST()) { + struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, $1); + + if (e == NULL) { + libconfig_yyerror(scanner, ctx, scan_ctx, err_array_elem_type); + YYABORT; + } else { + config_setting_set_format(e, CONFIG_FORMAT_BIN); + CAPTURE_PARSE_POS(e); + } + } else { + config_setting_set_int64(ctx->setting, $1); + config_setting_set_format(ctx->setting, CONFIG_FORMAT_BIN); + } + } + | TOK_OCT + { + if (IN_ARRAY() || IN_LIST()) { + struct config_setting_t *e = config_setting_set_int_elem(ctx->parent, -1, $1); + + if (e == NULL) { + 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, $1); + config_setting_set_format(ctx->setting, CONFIG_FORMAT_OCT); + } + } + | TOK_OCT64 + { + if (IN_ARRAY() || IN_LIST()) { + struct config_setting_t *e = config_setting_set_int64_elem(ctx->parent, -1, $1); + + if (e == NULL) { + 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, $1); + config_setting_set_format(ctx->setting, CONFIG_FORMAT_OCT); + } + } | TOK_FLOAT { if(IN_ARRAY() || IN_LIST()) |