mirror of
https://github.com/davatorium/rofi.git
synced 2025-07-31 21:59:25 -04:00
Make parser accept old + more CSS style elements
This commit is contained in:
parent
361d5c62d7
commit
b26d241f04
2 changed files with 7 additions and 18 deletions
|
@ -90,24 +90,25 @@ if ( queue == NULL ){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Go into parsing an entry */
|
/* Go into parsing an entry */
|
||||||
<INITIAL>"\{" {
|
<NAMESTR>"\{" {
|
||||||
g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) );
|
g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) );
|
||||||
BEGIN(ENTRY);
|
BEGIN(ENTRY);
|
||||||
return BOPEN;
|
return BOPEN;
|
||||||
}
|
}
|
||||||
/* Pop out of parsing an entry. */
|
/* Pop out of parsing an entry. */
|
||||||
<ENTRY>"\}" {
|
<ENTRY>"\}" {
|
||||||
|
g_queue_pop_head ( queue );
|
||||||
BEGIN(GPOINTER_TO_INT(g_queue_pop_head ( queue )));
|
BEGIN(GPOINTER_TO_INT(g_queue_pop_head ( queue )));
|
||||||
return BCLOSE;
|
return BCLOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
<INITIAL>"#" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(NAMESTR);return NAME_PREFIX;}
|
<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;}
|
<INITIAL,ENTRY>{WORD} { yylval->sval = g_strdup(yytext); return N_STRING;}
|
||||||
<NAMESTR>{WORD} { yylval->sval = g_strdup(yytext); return NAME_ELEMENT;}
|
<NAMESTR>{WORD} { yylval->sval = g_strdup(yytext); return NAME_ELEMENT;}
|
||||||
|
|
||||||
/* After Namestr/Classstr we want to go to state str, then to { */
|
/* 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
|
<INITIAL,ENTRY>{WHITESPACE}+ ; // ignore all whitespace
|
||||||
<PROPERTIES>{WHITESPACE}+ ; // ignore all whitespace
|
<PROPERTIES>{WHITESPACE}+ ; // ignore all whitespace
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ entries:
|
||||||
;
|
;
|
||||||
|
|
||||||
entry:
|
entry:
|
||||||
NAME_PREFIX name_path state_path BOPEN optional_properties BCLOSE
|
NAME_PREFIX name_path BOPEN optional_properties BCLOSE
|
||||||
{
|
{
|
||||||
ThemeWidget *widget = rofi_theme;
|
ThemeWidget *widget = rofi_theme;
|
||||||
for ( GList *iter = g_list_first ( $2 ); iter ; iter = g_list_next ( iter ) ) {
|
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_foreach ( $2, (GFunc)g_free , NULL );
|
||||||
g_list_free ( $2 );
|
g_list_free ( $2 );
|
||||||
widget->set = TRUE;
|
widget->set = TRUE;
|
||||||
for ( GList *iter = g_list_first ( $3 ); iter ; iter = g_list_next ( iter ) ) {
|
rofi_theme_widget_add_properties ( widget, $4);
|
||||||
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);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,14 +184,8 @@ pvalue: N_STRING { $$ = $1; }
|
||||||
name_path:
|
name_path:
|
||||||
NAME_ELEMENT { $$ = g_list_append ( NULL, $1 );}
|
NAME_ELEMENT { $$ = g_list_append ( NULL, $1 );}
|
||||||
| name_path NSEP NAME_ELEMENT { $$ = g_list_append ( $1, $3);}
|
| 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);}
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue