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

Allow * { } syntax for default values.

This commit is contained in:
Dave Davenport 2017-01-06 23:41:10 +01:00
parent b26d241f04
commit e388aa95c7
2 changed files with 22 additions and 2 deletions

View file

@ -31,6 +31,8 @@ PX (px)
EM (em) EM (em)
PERCENT (\%) PERCENT (\%)
ASTERIX \*
CENTER "center" CENTER "center"
NORTH "north" NORTH "north"
SOUTH "south" SOUTH "south"
@ -43,6 +45,7 @@ LS_SOLID "solid"
%x PROPERTIES %x PROPERTIES
%x NAMESTR %x NAMESTR
%x ENTRY %x ENTRY
%x DEFAULTS
%% %%
%{ %{
@ -89,6 +92,18 @@ if ( queue == NULL ){
YY_LLOC_START YY_LLOC_START
} }
<INITIAL>{ASTERIX} {
g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) );
BEGIN(DEFAULTS);
return PDEFAULTS;
}
<DEFAULTS>{WHITESPACE} {}
<DEFAULTS>"\{" {
g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) );
BEGIN(ENTRY);
return BOPEN;
}
/* Go into parsing an entry */ /* Go into parsing an entry */
<NAMESTR>"\{" { <NAMESTR>"\{" {
g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) );

View file

@ -53,13 +53,13 @@ int yylex (YYSTYPE *, YYLTYPE *);
%token NSEP "Name separator"; %token NSEP "Name separator";
%token NAME_PREFIX "Name prefix"; %token NAME_PREFIX "Name prefix";
%token WHITESPACE "White space"; %token WHITESPACE "White space";
%token PDEFAULTS "Default settings";
%type <sval> entry %type <sval> entry
%type <sval> pvalue %type <sval> pvalue
%type <theme> entries %type <theme> entries
%type <theme> start %type <theme> start
%type <name_path> name_path %type <name_path> name_path
%type <name_path> state_path
%type <property> property %type <property> property
%type <property_list> property_list %type <property_list> property_list
%type <property_list> optional_properties %type <property_list> optional_properties
@ -100,7 +100,12 @@ NAME_PREFIX name_path BOPEN optional_properties BCLOSE
g_list_free ( $2 ); g_list_free ( $2 );
widget->set = TRUE; widget->set = TRUE;
rofi_theme_widget_add_properties ( widget, $4); rofi_theme_widget_add_properties ( widget, $4);
}; }
|
PDEFAULTS BOPEN optional_properties BCLOSE {
rofi_theme_widget_add_properties ( rofi_theme, $3);
}
;
/** /**
* properties * properties