#include "commands.h"
#include "commands_parser.h"
#include "config_directives.h"
-//#include "config_parser.h"
+#include "config_parser.h"
#include "fake_outputs.h"
#include "display_version.h"
/* Whether the command requires calling 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);
extern Config config;
extern SLIST_HEAD(modes_head, Mode) modes;
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
#include "all.h"
+bool force_old_config_parser = false;
+
static pid_t configerror_pid = -1;
static Match current_match;
}
}
- /* now lex/parse it */
- yy_scan_string(new);
context = scalloc(sizeof(struct context));
context->filename = f;
- if (yyparse() != 0) {
- fprintf(stderr, "Could not parse configfile\n");
- exit(1);
+ if (force_old_config_parser) {
+ /* now lex/parse it */
+ 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);
start_configerror_nagbar(f);
}
- yylex_destroy();
+ if (force_old_config_parser)
+ yylex_destroy();
FREE(context->line_copy);
free(context);
FREE(font_pattern);
border_style:
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;
$$ = BS_NORMAL;
}
{"get_socketpath", no_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}
};
int option_index = 0, opt;
LOG("Initializing fake outputs: %s\n", optarg);
fake_outputs = sstrdup(optarg);
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 */
default: