diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-05-25 23:41:15 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-05-25 23:41:15 +0200 |
commit | c23df70aebf9d6926303b4ddb8d099a4d285949f (patch) | |
tree | 2eb4f57db7550584a032340d8f42a4492a634358 /lexer | |
parent | e387105091fb9802de474d00035a640bf06dabc3 (diff) |
Allow interface to be dynamically changed.
Diffstat (limited to 'lexer')
-rw-r--r-- | lexer/theme-lexer.l | 24 | ||||
-rw-r--r-- | lexer/theme-parser.y | 21 |
2 files changed, 40 insertions, 5 deletions
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index 80ee6584..826fff85 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -211,6 +211,9 @@ S_T_PARENT_RIGHT \) COMMA , FORWARD_SLASH \/ +LIST_OPEN \[ +LIST_CLOSE \] + LS_DASH "dash" LS_SOLID "solid" @@ -220,6 +223,7 @@ CONFIGURATION "configuration" %x INCLUDE %x PROPERTIES +%x PROPERTIES_LIST %x NAMESTR %x SECTION %x DEFAULTS @@ -382,7 +386,7 @@ if ( queue == NULL ){ /* After Namestr/Classstr we want to go to state str, then to { */ <INITIAL,SECTION>{WHITESPACE}+ ; // ignore all whitespace -<PROPERTIES>{WHITESPACE}+ ; // ignore all whitespace +<PROPERTIES,PROPERTIES_LIST>{WHITESPACE}+ ; // ignore all whitespace <SECTION>":" { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(PROPERTIES); return T_PSEP; } <PROPERTIES>";" { BEGIN(GPOINTER_TO_INT ( g_queue_pop_head ( queue ))); return T_PCLOSE;} @@ -448,7 +452,16 @@ if ( queue == NULL ){ /* Fluff */ <PROPERTIES>{S_T_PARENT_LEFT} { return T_PARENT_LEFT; } <PROPERTIES>{S_T_PARENT_RIGHT} { return T_PARENT_RIGHT; } -<PROPERTIES>{COMMA} { return T_COMMA; } +<PROPERTIES,PROPERTIES_LIST>{COMMA} { return T_COMMA; } +<PROPERTIES>{LIST_OPEN} { + g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); + BEGIN(PROPERTIES_LIST); + return T_LIST_OPEN; +} +<PROPERTIES_LIST>{LIST_CLOSE} { + BEGIN(GPOINTER_TO_INT(g_queue_pop_head ( queue ))); + return T_LIST_CLOSE; +} <PROPERTIES>{FORWARD_SLASH} { return T_FORWARD_SLASH; } /* Position */ <PROPERTIES>{CENTER} { return T_POS_CENTER; } @@ -521,7 +534,12 @@ if ( queue == NULL ){ <SECTION>. { return T_ERROR_SECTION; } -<PROPERTIES>. { +<PROPERTIES_LIST>{WORD} { + yylval->sval = g_strdup(yytext); + return T_ELEMENT; +} + +<PROPERTIES,PROPERTIES_LIST>. { return T_ERROR_PROPERTY; } <NAMESTR>. { diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index d66b7cc4..fd290e85 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -141,7 +141,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) WindowLocation wloc; ThemeColor colorval; ThemeWidget *theme; - GList *name_path; + GList *list; Property *property; GHashTable *property_list; Distance distance; @@ -163,6 +163,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %token <bval> T_BOOLEAN "Boolean value (true or false)" %token <colorval> T_COLOR "Hexidecimal color value" %token <sval> T_LINK "Reference" +%token <sval> T_ELEMENT "Name of element" %token T_POS_CENTER "Center" %token T_POS_EAST "East" %token T_POS_WEST "West" @@ -198,6 +199,8 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %token T_OPTIONAL_COMMA "Optional comma separator (',')" %token T_FORWARD_SLASH "forward slash ('/')" %token T_PERCENT "Percent sign ('%')" +%token T_LIST_OPEN "List open ('[')" +%token T_LIST_CLOSE "List close (']')" %token T_BOPEN "bracket open ('{')" %token T_BCLOSE "bracket close ('}')" @@ -213,7 +216,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %type <sval> t_entry %type <theme> t_entry_list -%type <name_path> t_entry_name_path +%type <list> t_entry_name_path %type <property> t_property %type <property_list> t_property_list %type <property_list> t_property_list_optional @@ -232,6 +235,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %type <ival> t_property_highlight_styles %type <ival> t_property_highlight_style %type <ival> t_property_line_style +%type <list> t_property_element_list %start t_entry_list %% @@ -363,6 +367,19 @@ t_property $$->name = $1; $$->value.color = $3; } +| t_property_name T_PSEP T_LIST_OPEN t_property_element_list T_LIST_CLOSE T_PCLOSE { + $$ = rofi_theme_property_create ( P_LIST ); + $$->name = $1; + $$->value.list = $4; +} +; + +/** List of elements */ +t_property_element_list +: T_ELEMENT { $$ = g_list_append ( NULL, $1); } +| t_property_element_list T_COMMA T_ELEMENT { + $$ = g_list_append ( $1, $3 ); +} ; /** |