9 %union ParseTokenData {
24 void yyerror(char *err);
33 void parse_token(ParseToken *token);
34 void parse_assign(char *name, ParseToken *token);
35 void parse_set_section(char *section);
39 %token <integer> INTEGER
40 %token <string> STRING
41 %token <identifier> IDENTIFIER
43 %token <character> '('
44 %token <character> ')'
45 %token <character> '{'
46 %token <character> '}'
47 %token <character> '='
48 %token <character> ','
49 %token <character> '\n'
53 %type <list> listtokens
58 | sections '[' IDENTIFIER ']' { parse_set_section($3); } '\n'
63 | lines tokens { t.type='\n'; t.data.character='\n'; parse_token(&t); } '\n'
65 | lines IDENTIFIER '=' listtoken { parse_assign($2, &t); } '\n'
70 tokens token { parse_token(&t); }
71 | token { parse_token(&t); }
75 REAL { t.type = TOKEN_REAL; t.data.real = $1; }
76 | INTEGER { t.type = TOKEN_INTEGER; t.data.integer = $1; }
77 | STRING { t.type = TOKEN_STRING; t.data.string = $1; }
78 | IDENTIFIER { t.type = TOKEN_IDENTIFIER; t.data.identifier = $1; }
79 | BOOL { t.type = TOKEN_BOOL; t.data.bool = $1; }
80 | list { t.type = TOKEN_LIST; t.data.list = $1; }
81 | '{' { t.type = $1; t.data.character = $1; }
82 | '}' { t.type = $1; t.data.character = $1; }
83 | ',' { t.type = $1; t.data.character = $1; }
87 '(' listtokens ')' { $$ = $2; }
91 listtokens listtoken { ParseToken *nt = g_new(ParseToken, 1);
94 $$ = g_list_append($1, nt);
96 | listtoken { ParseToken *nt = g_new(ParseToken, 1);
99 $$ = g_list_append(NULL, nt);
104 REAL { t.type = TOKEN_REAL; t.data.real = $1; }
105 | INTEGER { t.type = TOKEN_INTEGER; t.data.integer = $1; }
106 | STRING { t.type = TOKEN_STRING; t.data.string = $1; }
107 | IDENTIFIER { t.type = TOKEN_IDENTIFIER; t.data.identifier = $1; }
108 | BOOL { t.type = TOKEN_BOOL; t.data.bool = $1; }
109 | list { t.type = TOKEN_LIST; t.data.list = $1; }
110 | '{' { t.type = $1; t.data.character = $1; }
111 | '}' { t.type = $1; t.data.character = $1; }
112 | ',' { t.type = $1; t.data.character = $1; }
118 void yyerror(char *err) {
119 g_message("%s:%d: %s", path, yylineno, err);
124 /* try the user's rc */
125 path = g_build_filename(g_get_home_dir(), ".openbox", "rc3", NULL);
126 if ((yyin = fopen(path, "r")) == NULL) {
128 /* try the system wide rc */
129 path = g_build_filename(RCDIR, "rc3", NULL);
130 if ((yyin = fopen(path, "r")) == NULL) {
131 g_warning("No rc2 file found!");