3 %parse-param {struct parser_control *pc}
14 #include "obtheme.tab.h"
18 struct parser_control *parser_init(struct obthemedata *otd)
20 struct parser_control *out;
21 out = calloc(1, sizeof(struct parser_control));
22 out->include_stack_ptr = 0;
27 void parser_finish(struct parser_control *c)
42 struct material material;
50 %token LEFT_ARROW RIGHT_ARROW DOUBLE_ARROW
51 %token SEMICOLON AT COLON DEFAULT NOT
53 %token <string> STRING ID
54 %token <integer> NUMBER SUBST BULK BIG LITTLE
55 %token THEME FRAME SPACE GEOMETRY MATERIAL GRADIENT
56 %token CONTEXT CURSOR UP ANCHOR CLASS TEXTURE OPACITY
59 %type <decor> decoritems classitem
61 %type <class> class classitems
63 %type <material> material_props
64 %type <realnum> opacity
65 %type <space> spaceconstraints
66 %type <vector> up anchor
69 theme_object : material_decl
73 theme_objects : /* empty */
74 | theme_objects theme_object
77 theme : THEME ID LCB classes RCB {
79 out = malloc(sizeof(struct theme));
82 g_hash_table_insert(pc->target->themes, $2, out);
86 opacity : OPACITY LB NUMBER RB { $$ = $3; }
89 material_props : /* empty */ { memset(&$$, 0, sizeof($$)); }
90 | material_props opacity {
96 material_decl : MATERIAL ID LCB material_props RCB {
98 out = malloc(sizeof(struct material));
100 g_hash_table_insert(pc->target->materials, $2, out);
104 anchor : ANCHOR LB NUMBER NUMBER NUMBER RB {
111 up : UP LB NUMBER NUMBER NUMBER RB {
118 spaceconstraints: /* empty */ { memset(&$$, 0, sizeof($$)); }
119 | spaceconstraints anchor { $1.anchor = $2; $$ = $1; }
120 | spaceconstraints up { $1.up = $2; $$ = $1; }
123 space : SPACE LCB spaceconstraints RCB {
128 shape : SHAPEOF LB ID RB
131 geometry_item : /* empty */
135 geometry : GEOMETRY LCB geometry_item RCB
138 material_use : MATERIAL LB ID RB
144 classitems : /* empty */ { $$.tree = NULL; $$.name = NULL; }
145 | classitems classitem {
146 struct decor *out = malloc(sizeof(struct decor));
148 $1.tree = g_slist_prepend($1.tree, out);
153 classes : /* empty */ { $$ = g_hash_table_new(g_str_hash, g_str_equal); }
155 struct class *out = malloc(sizeof(struct class));
158 g_hash_table_insert($1, out->name, out);
162 class : CLASS ID LCB classitems RCB {
168 decoritems : /* empty */ {
169 memset(&$$, 0, sizeof($$));
173 struct decor *out = malloc(sizeof(struct decor));
176 $$.children = g_slist_append($1.children, out);
178 | decoritems space { $1.space = $2; $$ = $1; }
179 | decoritems material_use
180 | decoritems geometry
183 | decoritems gradient
189 decor : DECOR ID LCB decoritems RCB {
195 texture : TEXTURE LCB RCB
198 context : CONTEXT LB ID RB
201 cursor : CURSOR LB ID RB
203 gradient : GRADIENT LB ID RB