use the new parser by default
you can force the old parser with the command line flag --force-old-config-parser-v4.4-only (which will be present in v4.4 only, as the name suggests)
This commit is contained in:
parent
2738f13798
commit
20c0fa7cfb
|
@ -80,7 +80,7 @@
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "commands_parser.h"
|
#include "commands_parser.h"
|
||||||
#include "config_directives.h"
|
#include "config_directives.h"
|
||||||
//#include "config_parser.h"
|
#include "config_parser.h"
|
||||||
#include "fake_outputs.h"
|
#include "fake_outputs.h"
|
||||||
#include "display_version.h"
|
#include "display_version.h"
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,11 @@ struct CommandResult {
|
||||||
|
|
||||||
/* Whether the command requires calling tree_render. */
|
/* Whether the command requires calling tree_render. */
|
||||||
bool needs_tree_render;
|
bool needs_tree_render;
|
||||||
|
|
||||||
|
/* The next state to transition to. Passed to the function so that we can
|
||||||
|
* determine the next state as a result of a function call, like
|
||||||
|
* cfg_criteria_pop_state() does. */
|
||||||
|
int next_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CommandResult *parse_command(const char *input);
|
struct CommandResult *parse_command(const char *input);
|
||||||
|
|
|
@ -24,6 +24,8 @@ extern char *current_configpath;
|
||||||
extern Config config;
|
extern Config config;
|
||||||
extern SLIST_HEAD(modes_head, Mode) modes;
|
extern SLIST_HEAD(modes_head, Mode) modes;
|
||||||
extern TAILQ_HEAD(barconfig_head, Barconfig) barconfigs;
|
extern TAILQ_HEAD(barconfig_head, Barconfig) barconfigs;
|
||||||
|
/* defined in src/cfgparse.y */
|
||||||
|
extern bool force_old_config_parser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used during the config file lexing/parsing to keep the state of the lexer
|
* Used during the config file lexing/parsing to keep the state of the lexer
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
#include "all.h"
|
#include "all.h"
|
||||||
|
|
||||||
|
bool force_old_config_parser = false;
|
||||||
|
|
||||||
static pid_t configerror_pid = -1;
|
static pid_t configerror_pid = -1;
|
||||||
|
|
||||||
static Match current_match;
|
static Match current_match;
|
||||||
|
@ -625,15 +627,20 @@ void parse_file(const char *f) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now lex/parse it */
|
|
||||||
yy_scan_string(new);
|
|
||||||
|
|
||||||
context = scalloc(sizeof(struct context));
|
context = scalloc(sizeof(struct context));
|
||||||
context->filename = f;
|
context->filename = f;
|
||||||
|
|
||||||
if (yyparse() != 0) {
|
if (force_old_config_parser) {
|
||||||
fprintf(stderr, "Could not parse configfile\n");
|
/* now lex/parse it */
|
||||||
exit(1);
|
yy_scan_string(new);
|
||||||
|
if (yyparse() != 0) {
|
||||||
|
fprintf(stderr, "Could not parse configfile\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
struct ConfigResult *config_output = parse_config(new, context);
|
||||||
|
yajl_gen_free(config_output->json_gen);
|
||||||
}
|
}
|
||||||
|
|
||||||
check_for_duplicate_bindings(context);
|
check_for_duplicate_bindings(context);
|
||||||
|
@ -669,7 +676,8 @@ void parse_file(const char *f) {
|
||||||
start_configerror_nagbar(f);
|
start_configerror_nagbar(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
yylex_destroy();
|
if (force_old_config_parser)
|
||||||
|
yylex_destroy();
|
||||||
FREE(context->line_copy);
|
FREE(context->line_copy);
|
||||||
free(context);
|
free(context);
|
||||||
FREE(font_pattern);
|
FREE(font_pattern);
|
||||||
|
@ -1485,6 +1493,7 @@ new_float:
|
||||||
border_style:
|
border_style:
|
||||||
TOK_NORMAL optional_border_width
|
TOK_NORMAL optional_border_width
|
||||||
{
|
{
|
||||||
|
/* FIXME: the whole border_style thing actually screws up when new_float is used because it overwrites earlier values :-/ */
|
||||||
config.default_border_width = $2;
|
config.default_border_width = $2;
|
||||||
$$ = BS_NORMAL;
|
$$ = BS_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,6 +269,7 @@ int main(int argc, char *argv[]) {
|
||||||
{"get_socketpath", no_argument, 0, 0},
|
{"get_socketpath", no_argument, 0, 0},
|
||||||
{"fake_outputs", required_argument, 0, 0},
|
{"fake_outputs", required_argument, 0, 0},
|
||||||
{"fake-outputs", required_argument, 0, 0},
|
{"fake-outputs", required_argument, 0, 0},
|
||||||
|
{"force-old-config-parser-v4.4-only", no_argument, 0, 0},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
int option_index = 0, opt;
|
int option_index = 0, opt;
|
||||||
|
@ -372,6 +373,10 @@ int main(int argc, char *argv[]) {
|
||||||
LOG("Initializing fake outputs: %s\n", optarg);
|
LOG("Initializing fake outputs: %s\n", optarg);
|
||||||
fake_outputs = sstrdup(optarg);
|
fake_outputs = sstrdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
} else if (strcmp(long_options[option_index].name, "force-old-config-parser-v4.4-only") == 0) {
|
||||||
|
LOG("FORCING OLD CONFIG PARSER!\n");
|
||||||
|
force_old_config_parser = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
/* fall-through */
|
/* fall-through */
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue