9 %union ParseTokenData {
26 void yyerror(char *err);
35 void parse_token(ParseToken *token);
36 void parse_assign(char *name, ParseToken *token);
37 void parse_set_section(char *section);
41 %token <integer> INTEGER
42 %token <string> STRING
43 %token <identifier> IDENTIFIER
45 %token <character> '('
46 %token <character> ')'
47 %token <character> '{'
48 %token <character> '}'
49 %token <character> '='
50 %token <character> ','
51 %token <character> '\n'
55 %type <list> listtokens
60 | sections '[' IDENTIFIER ']' { parse_set_section($3); } '\n'
65 | lines tokens { t.type='\n'; t.data.character='\n'; parse_token(&t); } '\n'
67 | lines IDENTIFIER '=' listtoken { parse_assign($2, &t); } '\n'
72 tokens token { parse_token(&t); }
73 | token { parse_token(&t); }
77 REAL { t.type = TOKEN_REAL; t.data.real = $1; }
78 | INTEGER { t.type = TOKEN_INTEGER; t.data.integer = $1; }
79 | STRING { t.type = TOKEN_STRING; t.data.string = $1; }
80 | IDENTIFIER { t.type = TOKEN_IDENTIFIER; t.data.identifier = $1; }
81 | BOOLEAN { t.type = TOKEN_BOOL; t.data.bool = $1; }
82 | list { t.type = TOKEN_LIST; t.data.list = $1; }
83 | '{' { t.type = $1; t.data.character = $1; }
84 | '}' { t.type = $1; t.data.character = $1; }
85 | ',' { t.type = $1; t.data.character = $1; }
89 '(' listtokens ')' { $$ = $2; }
93 listtokens listtoken { ParseToken *nt = g_new(ParseToken, 1);
96 $$ = g_list_append($1, nt);
98 | listtoken { ParseToken *nt = g_new(ParseToken, 1);
101 $$ = g_list_append(NULL, nt);
106 REAL { t.type = TOKEN_REAL; t.data.real = $1; }
107 | INTEGER { t.type = TOKEN_INTEGER; t.data.integer = $1; }
108 | STRING { t.type = TOKEN_STRING; t.data.string = $1; }
109 | IDENTIFIER { t.type = TOKEN_IDENTIFIER; t.data.identifier = $1; }
110 | BOOLEAN { t.type = TOKEN_BOOL; t.data.bool = $1; }
111 | list { t.type = TOKEN_LIST; t.data.list = $1; }
112 | '{' { t.type = $1; t.data.character = $1; }
113 | '}' { t.type = $1; t.data.character = $1; }
114 | ',' { t.type = $1; t.data.character = $1; }
122 void yyerror(char *err) {
123 g_message("%s:%d: %s", path, lineno, err);
128 /* try the user's rc */
129 path = g_build_filename(g_get_home_dir(), ".openbox", "rc3", NULL);
130 if ((yyin = fopen(path, "r")) == NULL) {
132 /* try the system wide rc */
133 path = g_build_filename(RCDIR, "rc3", NULL);
134 if ((yyin = fopen(path, "r")) == NULL) {
135 g_warning("No rc2 file found!");