i3
config_parser.h
Go to the documentation of this file.
1/*
2 * vim:ts=4:sw=4:expandtab
3 *
4 * i3 - an improved tiling window manager
5 * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6 *
7 * config_parser.h: config parser-related definitions
8 *
9 */
10#pragma once
11
12#include <config.h>
13
14#include <yajl/yajl_gen.h>
15
16SLIST_HEAD(variables_head, Variable);
17extern pid_t config_error_nagbar_pid;
18
20 /* Just a pointer, not dynamically allocated. */
21 const char *identifier;
22 enum {
26 union {
27 char *str;
28 long num;
29 } val;
30};
31
32struct stack {
33 struct stack_entry stack[10];
34};
35
36struct parser_ctx {
38
39 int state;
41
42 /* A list which contains the states that lead to the current state, e.g.
43 * INITIAL, WORKSPACE_LAYOUT.
44 * When jumping back to INITIAL, statelist_idx will simply be set to 1
45 * (likewise for other states, e.g. MODE or BAR).
46 * This list is used to process the nearest error token. */
47 int statelist[10];
48 /* NB: statelist_idx points to where the next entry will be inserted */
50
51 /*******************************************************************************
52 * The (small) stack where identified literals are stored during the parsing
53 * of a single config directive (like $workspace).
54 ******************************************************************************/
55 struct stack *stack;
56
57 struct variables_head variables;
58
60};
61
69 struct parser_ctx *ctx;
70
71 /* The next state to transition to. Passed to the function so that we can
72 * determine the next state as a result of a function call, like
73 * cfg_criteria_pop_state() does. */
75
76 /* Whether any error happened while processing this config directive. */
78};
79
83void start_config_error_nagbar(const char *configpath, bool has_errors);
84
89void free_variables(struct parser_ctx *ctx);
90
96
105parse_file_result_t parse_file(struct parser_ctx *ctx, const char *f, IncludedFile *included_file);
static xcb_cursor_context_t * ctx
Definition xcursor.c:19
pid_t config_error_nagbar_pid
parse_file_result_t parse_file(struct parser_ctx *ctx, const char *f, IncludedFile *included_file)
Parses the given file by first replacing the variables, then calling parse_config and launching i3-na...
parse_file_result_t
@ PARSE_FILE_CONFIG_ERRORS
@ PARSE_FILE_SUCCESS
@ PARSE_FILE_FAILED
void free_variables(struct parser_ctx *ctx)
Releases the memory of all variables in ctx.
void start_config_error_nagbar(const char *configpath, bool has_errors)
launch nagbar to indicate errors in the configuration file.
#define SLIST_HEAD(name, type)
Definition queue.h:93
union stack_entry::@3 val
enum stack_entry::@2 type
const char * identifier
struct stack * stack
struct variables_head variables
Match current_match
int statelist[10]
An intermediate representation of the result of a parse_config call.
struct parser_ctx * ctx
Holds a user-assigned variable for parsing the configuration file.
List entry struct for an included file.
A "match" is a data structure which acts like a mask or expression to match certain windows or not.
Definition data.h:529