1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-11 13:50:48 -05:00

Make parser accept old + more CSS style elements

This commit is contained in:
Dave Davenport 2017-01-06 23:25:55 +01:00
parent 361d5c62d7
commit b26d241f04
2 changed files with 7 additions and 18 deletions

View file

@ -90,24 +90,25 @@ if ( queue == NULL ){
}
/* Go into parsing an entry */
<INITIAL>"\{" {
<NAMESTR>"\{" {
g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) );
BEGIN(ENTRY);
return BOPEN;
}
/* Pop out of parsing an entry. */
<ENTRY>"\}" {
g_queue_pop_head ( queue );
BEGIN(GPOINTER_TO_INT(g_queue_pop_head ( queue )));
return BCLOSE;
}
<INITIAL>"#" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(NAMESTR);return NAME_PREFIX;}
<INITIAL,NAMESTR>"." { return NSEP; }
<NAMESTR>\.|{WHITESPACE} { return NSEP; }
<INITIAL,ENTRY>{WORD} { yylval->sval = g_strdup(yytext); return N_STRING;}
<NAMESTR>{WORD} { yylval->sval = g_strdup(yytext); return NAME_ELEMENT;}
/* After Namestr/Classstr we want to go to state str, then to { */
<NAMESTR>{WHITESPACE} { BEGIN(GPOINTER_TO_INT (g_queue_pop_head ( queue )));}
/*<NAMESTR>{WHITESPACE} { BEGIN(GPOINTER_TO_INT (g_queue_pop_head ( queue )));}*/
<INITIAL,ENTRY>{WHITESPACE}+ ; // ignore all whitespace
<PROPERTIES>{WHITESPACE}+ ; // ignore all whitespace

View file

@ -90,7 +90,7 @@ entries:
;
entry:
NAME_PREFIX name_path state_path BOPEN optional_properties BCLOSE
NAME_PREFIX name_path BOPEN optional_properties BCLOSE
{
ThemeWidget *widget = rofi_theme;
for ( GList *iter = g_list_first ( $2 ); iter ; iter = g_list_next ( iter ) ) {
@ -99,13 +99,7 @@ NAME_PREFIX name_path state_path BOPEN optional_properties BCLOSE
g_list_foreach ( $2, (GFunc)g_free , NULL );
g_list_free ( $2 );
widget->set = TRUE;
for ( GList *iter = g_list_first ( $3 ); iter ; iter = g_list_next ( iter ) ) {
widget = rofi_theme_find_or_create_name ( widget, iter->data );
}
g_list_foreach ( $3, (GFunc)g_free , NULL );
g_list_free ( $3 );
widget->set = TRUE;
rofi_theme_widget_add_properties ( widget, $5);
rofi_theme_widget_add_properties ( widget, $4);
};
/**
@ -190,14 +184,8 @@ pvalue: N_STRING { $$ = $1; }
name_path:
NAME_ELEMENT { $$ = g_list_append ( NULL, $1 );}
| name_path NSEP NAME_ELEMENT { $$ = g_list_append ( $1, $3);}
| name_path NSEP { $$ = $1; }
;
state_path:
%empty { $$ = NULL; }
| N_STRING { $$ = g_list_append ( NULL, $1 );}
| state_path NSEP N_STRING { $$ = g_list_append ( $1, $3);}
;
%%