37#define AS_CFG_TOKEN_EOF 0
39#define AS_CFG_TOKEN_COL 1
41#define AS_CFG_TOKEN_STR 2
43#define AS_CFG_TOKEN_INT 3
45#define AS_CFG_TOKEN_COM 4
47#define AS_CFG_TOKEN_KEY 5
48#define AS_CFG_TOKEN_SQR 6
50#define AS_NEXT_TOKEN token = token->next;
52#define AS_EXPECT_TOKEN(__type__, __msg__) \
53 if (token->type != __type__) { \
54 printf("Error on line %d, %d: %s\n", token->line, token->column, __msg__); \
55 AS_DEBUG_MSG("Error on line %d, %d: %s\n", token->line, token->column, __msg__); \
58#define AS_EXPECT_VALUE(__value__, __msg__) \
59 if (token->value != __value__) { \
60 printf("Error on line %d, %d: %s\n", token->line, token->column, __msg__); \
61 AS_DEBUG_MSG("Error on line %d, %d: %s\n", token->line, token->column, __msg__); \
80 AS_CFG_LOOKUP_BUFFER_LEFT,
81 AS_CFG_LOOKUP_BUFFER_RIGHT,
82 AS_CFG_LOOKUP_WINDOW_LEFT,
83 AS_CFG_LOOKUP_WINDOW_RIGHT,
84 AS_CFG_LOOKUP_FILE_SAVE,
85 AS_CFG_LOOKUP_FILE_SAVE_ALL,
86 AS_CFG_LOOKUP_FILE_LOAD,
87 AS_CFG_LOOKUP_SELECTION,
88 AS_CFG_LOOKUP_MOVE_LN_UP,
89 AS_CFG_LOOKUP_MOVE_LN_DOWN,
90 AS_CFG_LOOKUP_COLDESC_LEFT,
91 AS_CFG_LOOKUP_COLDESC_RIGHT,
93 AS_CFG_LOOKUP_KEYBOARD,
94 AS_CFG_LOOKUP_START_SCR,
97 AS_CFG_LOOKUP_BG_DISABLE,
99 AS_CFG_LOOKUP_LOGO_BMP,
100 AS_CFG_LOOKUP_COLUMNS,
101 AS_CFG_LOOKUP_DEFAULT,
102 AS_CFG_LOOKUP_DEFINE,
103 AS_CFG_LOOKUP_INCLUDE,
104 AS_CFG_LOOKUP_FOREGROUND,
105 AS_CFG_LOOKUP_BACKGROUND,
111static const char *As_LexStrLookup[] = {
112 [AS_CFG_LOOKUP_UP] =
"up",
113 [AS_CFG_LOOKUP_DOWN] =
"down",
114 [AS_CFG_LOOKUP_LEFT] =
"left",
115 [AS_CFG_LOOKUP_RIGHT] =
"right",
116 [AS_CFG_LOOKUP_ENTER] =
"enter",
117 [AS_CFG_LOOKUP_BUFFER_LEFT] =
"buffer_left",
118 [AS_CFG_LOOKUP_BUFFER_RIGHT] =
"buffer_right",
119 [AS_CFG_LOOKUP_WINDOW_LEFT] =
"window_left",
120 [AS_CFG_LOOKUP_WINDOW_RIGHT] =
"window_right",
121 [AS_CFG_LOOKUP_FILE_SAVE] =
"file_save",
122 [AS_CFG_LOOKUP_FILE_SAVE_ALL] =
"file_save_all",
123 [AS_CFG_LOOKUP_FILE_LOAD] =
"file_load",
124 [AS_CFG_LOOKUP_SELECTION] =
"selection",
125 [AS_CFG_LOOKUP_MOVE_LN_UP] =
"move_line_up",
126 [AS_CFG_LOOKUP_MOVE_LN_DOWN] =
"move_line_down",
127 [AS_CFG_LOOKUP_COLDESC_LEFT] =
"column_left",
128 [AS_CFG_LOOKUP_COLDESC_RIGHT] =
"column_right",
130 [AS_CFG_LOOKUP_KEYBOARD] =
"keyboard",
131 [AS_CFG_LOOKUP_START_SCR] =
"start_screen",
132 [AS_CFG_LOOKUP_THEMES] =
"themes",
133 [AS_CFG_LOOKUP_USE] =
"use",
134 [AS_CFG_LOOKUP_BG_DISABLE] =
"background_disable",
135 [AS_CFG_LOOKUP_KEYSEQ] =
"keyseq",
136 [AS_CFG_LOOKUP_LOGO_BMP] =
"logo_bmp",
137 [AS_CFG_LOOKUP_COLUMNS] =
"columns",
138 [AS_CFG_LOOKUP_DEFAULT] =
"default",
139 [AS_CFG_LOOKUP_DEFINE] =
"define",
140 [AS_CFG_LOOKUP_INCLUDE] =
"include",
141 [AS_CFG_LOOKUP_FOREGROUND] =
"foreground",
142 [AS_CFG_LOOKUP_BACKGROUND] =
"background",
AS_LEXSTRLOOKUP_IDXS
Definition config.h:74
struct AS_CfgTok * cfg_lex(FILE *file)
Definition config.c:136
int read_config()
Definition config.c:305
int type
The type of the token (AS_CFG_TOKEN_x).
Definition config.h:150
int line
The line number the token was found on.
Definition config.h:154
struct AS_CfgTok * next
Pointer to the next token.
Definition config.h:160
char * str
String for tokens of type AS_CFG_TOKEN_STR.
Definition config.h:158
int column
The column number the token was found on.
Definition config.h:156
int value
An integral value if the token has one.
Definition config.h:152