9 %union ParseTokenData {
24 void yyerror(char *err);
33 void parse_token(ParseToken *token);
34 void parse_set_section(char *section);
38 %token <integer> INTEGER
39 %token <string> STRING
40 %token <identifier> IDENTIFIER
42 %token <character> '('
43 %token <character> ')'
44 %token <character> '{'
45 %token <character> '}'
46 %token <character> '='
47 %token <character> ','
48 %token <character> '\n'
52 %type <list> listtokens
57 | sections '[' IDENTIFIER ']' { parse_set_section($3); } '\n' lines
61 | lines tokens '\n' { t.type = $3; t.data.character = $3; parse_token(&t); }
70 REAL { t.type = TOKEN_REAL; t.data.real = $1; parse_token(&t); }
71 | INTEGER { t.type = TOKEN_INTEGER; t.data.integer = $1;
73 | STRING { t.type = TOKEN_STRING; t.data.string = $1; parse_token(&t); }
74 | IDENTIFIER { t.type = TOKEN_IDENTIFIER; t.data.identifier = $1;
76 | BOOL { t.type = TOKEN_BOOL; t.data.bool = $1; parse_token(&t); }
77 | list { t.type = TOKEN_LIST; t.data.list = $1; parse_token(&t); }
78 | '{' { t.type = $1; t.data.character = $1; parse_token(&t); }
79 | '}' { t.type = $1; t.data.character = $1; parse_token(&t); }
80 | '=' { t.type = $1; t.data.character = $1; parse_token(&t); }
81 | ',' { t.type = $1; t.data.character = $1; parse_token(&t); }
85 '(' listtokens ')' { $$ = $2; }
89 listtokens listtoken { ParseToken *nt = g_new(ParseToken, 1);
92 $$ = g_list_append($1, nt);
94 | listtoken { ParseToken *nt = g_new(ParseToken, 1);
97 $$ = g_list_append(NULL, nt);
102 REAL { t.type = TOKEN_REAL; t.data.real = $1; }
103 | INTEGER { t.type = TOKEN_INTEGER; t.data.integer = $1; }
104 | STRING { t.type = TOKEN_STRING; t.data.string = $1; }
105 | IDENTIFIER { t.type = TOKEN_IDENTIFIER; t.data.identifier = $1; }
106 | BOOL { t.type = TOKEN_BOOL; t.data.bool = $1; }
107 | list { t.type = TOKEN_LIST; t.data.list = $1; }
108 | '{' { t.type = $1; t.data.character = $1; }
109 | '}' { t.type = $1; t.data.character = $1; }
110 | '=' { t.type = $1; t.data.character = $1; }
111 | ',' { t.type = $1; t.data.character = $1; }
117 void yyerror(char *err) {
118 g_message("%s:%d: %s", path, yylineno, err);
123 /* try the user's rc */
124 path = g_build_filename(g_get_home_dir(), ".openbox", "rc3", NULL);
125 if ((yyin = fopen(path, "r")) == NULL) {
127 /* try the system wide rc */
128 path = g_build_filename(RCDIR, "rc3", NULL);
129 if ((yyin = fopen(path, "r")) == NULL) {
130 g_warning("No rc2 file found!");