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)
PERCENT (\%)
ASTERIX \*
CENTER "center"
NORTH "north"
SOUTH "south"
@ -43,6 +45,7 @@ LS_SOLID "solid"
%x PROPERTIES
%x NAMESTR
%x ENTRY
%x DEFAULTS
%%
%{
@ -89,6 +92,18 @@ if ( queue == NULL ){
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 */
<NAMESTR>"\{" {
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 NAME_PREFIX "Name prefix";
%token WHITESPACE "White space";
%token PDEFAULTS "Default settings";
%type <sval> entry
%type <sval> pvalue
%type <theme> entries
%type <theme> start
%type <name_path> name_path
%type <name_path> state_path
%type <property> property
%type <property_list> property_list
%type <property_list> optional_properties
@ -100,7 +100,12 @@ NAME_PREFIX name_path BOPEN optional_properties BCLOSE
g_list_free ( $2 );
widget->set = TRUE;
rofi_theme_widget_add_properties ( widget, $4);
};
}
|
PDEFAULTS BOPEN optional_properties BCLOSE {
rofi_theme_widget_add_properties ( rofi_theme, $3);
}
;
/**
* properties