From e17d63f5aef56741ac57932158850112e82cc6d8 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Thu, 21 Mar 2019 10:33:50 +0100 Subject: [PATCH] [Lexer] Fix nested () in variable default field. - var ( a, rgba(0,0,0,0)) was broke Fixes: #936 --- lexer/theme-lexer.l | 10 +++++----- lexer/theme-parser.y | 6 ++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index d6a4c675..02c9978e 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -519,11 +519,11 @@ if ( queue == NULL ){ {VAR_START}{S_T_PARENT_LEFT} { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); BEGIN(PROPERTIES_VAR); - return T_VAR_START; + return T_PARENT_LEFT; } {S_T_PARENT_RIGHT} { BEGIN(GPOINTER_TO_INT(g_queue_pop_head ( queue ))); - return T_VAR_CLOSE; + return T_PARENT_RIGHT; } {COMMA} { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); @@ -534,10 +534,10 @@ if ( queue == NULL ){ // Pop 2. g_queue_pop_head ( queue ); BEGIN(GPOINTER_TO_INT(g_queue_pop_head ( queue ))); - return T_VAR_CLOSE; + return T_PARENT_RIGHT; } -{S_T_PARENT_LEFT} { return T_PARENT_LEFT; } -{S_T_PARENT_RIGHT} { return T_PARENT_RIGHT; } +{S_T_PARENT_LEFT} { return T_PARENT_LEFT; } +{S_T_PARENT_RIGHT} { return T_PARENT_RIGHT; } {COMMA} { return T_COMMA; } {LIST_OPEN} { g_queue_push_head ( queue, GINT_TO_POINTER (YY_START) ); diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index 642d583c..2ec5de77 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -199,8 +199,6 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %token T_COL_HWB "hwb colorscheme" %token T_COL_CMYK "cmyk colorscheme" -%token T_VAR_START "Variable" -%token T_VAR_CLOSE "Variable close" %token T_PARENT_LEFT "Parent left ('(')" %token T_PARENT_RIGHT "Parent right (')')" %token T_COMMA "comma separator (',')" @@ -368,12 +366,12 @@ t_property $$ = $3; $$->name = $1; } -| t_property_name T_PSEP T_VAR_START T_ELEMENT T_VAR_CLOSE T_PCLOSE{ +| t_property_name T_PSEP T_PARENT_LEFT T_ELEMENT T_PARENT_RIGHT T_PCLOSE{ $$ = rofi_theme_property_create ( P_LINK ); $$->name = $1; $$->value.link.name = $4; } -| t_property_name T_PSEP T_VAR_START T_ELEMENT T_COMMA t_property_element T_VAR_CLOSE T_PCLOSE{ +| t_property_name T_PSEP T_PARENT_LEFT T_ELEMENT T_COMMA t_property_element T_PARENT_RIGHT T_PCLOSE{ $$ = rofi_theme_property_create ( P_LINK ); $$->name = $1; $$->value.link.name = $4;