summaryrefslogtreecommitdiffstats
path: root/lexer
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-01-06 23:41:10 +0100
committerDave Davenport <qball@gmpclient.org>2017-01-06 23:41:10 +0100
commite388aa95c758f115188f63bb732859716dd19c65 (patch)
tree2d40be28813c1e81f4c43e2f4e69ecf7b538e626 /lexer
parentb26d241f04059c858462367318f1a6427053a8b4 (diff)
Allow * { } syntax for default values.
Diffstat (limited to 'lexer')
-rw-r--r--lexer/theme-lexer.l15
-rw-r--r--lexer/theme-parser.y9
2 files changed, 22 insertions, 2 deletions
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l
index 9af32541..0df89107 100644
--- a/lexer/theme-lexer.l
+++ b/lexer/theme-lexer.l
@@ -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) );
diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y
index 01c66ee0..4bf811df 100644
--- a/lexer/theme-parser.y
+++ b/lexer/theme-parser.y
@@ -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