diff options
Diffstat (limited to 'lexer')
-rw-r--r-- | lexer/theme-lexer.l | 1 | ||||
-rw-r--r-- | lexer/theme-parser.y | 31 |
2 files changed, 27 insertions, 5 deletions
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index 6edea302..1eb47aec 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -394,6 +394,7 @@ if ( queue == NULL ){ } <NAMESTR>\.|{WHITESPACE} { return T_NSEP; } +<NAMESTR>,{WHITESPACE}* { return T_SSEP; } <SECTION>{WORD} { yylval->sval = g_strdup(yytext); return T_PROP_NAME;} <NAMESTR>{WORD} { yylval->sval = g_strdup(yytext); return T_NAME_ELEMENT;} diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index a2bce6c2..7a13702d 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -212,6 +212,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %token T_PSEP "property separator (':')" %token T_PCLOSE "property close (';')" %token T_NSEP "Name separator (' ' or '.')" +%token T_SSEP "Selector separator (',')" %token T_NAME_PREFIX "Element section ('# {name} { ... }')" %token T_WHITESPACE "White space" %token T_PDEFAULTS "Default settings section ( '* { ... }')" @@ -224,6 +225,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %type <sval> t_entry %type <theme> t_entry_list %type <list> t_entry_name_path +%type <list> t_entry_name_path_selectors %type <property> t_property %type <property_list> t_property_list %type <property_list> t_property_list_optional @@ -263,20 +265,29 @@ t_entry_list: ; t_entry: -T_NAME_PREFIX t_entry_name_path T_BOPEN t_property_list_optional T_BCLOSE +T_NAME_PREFIX t_entry_name_path_selectors T_BOPEN t_property_list_optional T_BCLOSE { + for ( GList *liter = g_list_first ( $2); liter; liter = g_list_next ( liter ) ) { ThemeWidget *widget = rofi_theme; - for ( GList *iter = g_list_first ( $2 ); iter ; iter = g_list_next ( iter ) ) { + for ( GList *iter = g_list_first ( (GList*)liter->data ); iter ; iter = g_list_next ( iter ) ) { widget = rofi_theme_find_or_create_name ( widget, iter->data ); } - g_list_foreach ( $2, (GFunc)g_free , NULL ); - g_list_free ( $2 ); + g_list_foreach ( (GList*)liter->data, (GFunc)g_free , NULL ); + g_list_free ( (GList*)liter->data ); widget->set = TRUE; rofi_theme_widget_add_properties ( widget, $4); + } + if ( $4 ) { + g_hash_table_destroy ( $4 ); + } + g_list_free ( $2 ); } | T_PDEFAULTS T_BOPEN t_property_list_optional T_BCLOSE { rofi_theme_widget_add_properties ( rofi_theme, $3); + if ( $3 ) { + g_hash_table_destroy ( $3 ); + } } | T_CONFIGURATION T_BOPEN t_config_property_list_optional T_BCLOSE { // Dummy at this point. @@ -327,7 +338,7 @@ t_property : t_property_name T_PSEP T_INHERIT T_PCLOSE { $$ = rofi_theme_property_create ( P_INHERIT ); $$->name = $1; - } + } | t_property_name T_PSEP T_INT T_PCLOSE { $$ = rofi_theme_property_create ( P_INTEGER ); $$->name = $1; @@ -617,6 +628,16 @@ t_property_name : T_PROP_NAME { $$ = $1; } ; +t_entry_name_path_selectors: +t_entry_name_path { $$ = g_list_append ( NULL, $1 ); } +| t_entry_name_path_selectors T_SSEP t_entry_name_path { + $$ = g_list_append ( $1, $3); +} +| t_entry_name_path_selectors T_SSEP { + $$ = $1; +} + +; t_entry_name_path: T_NAME_ELEMENT { $$ = g_list_append ( NULL, $1 );} | t_entry_name_path T_NSEP T_NAME_ELEMENT { $$ = g_list_append ( $1, $3);} |