From d4bf5ad02081038da3247c5833bfa6aaf8010ade Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Thu, 7 Sep 2017 08:43:00 +0200 Subject: [PATCH] Allow 0 in padding when passing more then 1 argument. --- lexer/theme-parser.y | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index 7a13702d..de22b98b 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -237,6 +237,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %type t_property_color_value_angle %type t_property_name %type t_property_distance +%type t_property_distance_zero %type t_property_unit %type t_property_position %type t_property_position_ew @@ -369,17 +370,17 @@ t_property $$->name = $1; $$->value.padding = (RofiPadding){ $3, $3, $3, $3 }; } -| t_property_name T_PSEP t_property_distance t_property_distance T_PCLOSE { +| t_property_name T_PSEP t_property_distance_zero t_property_distance_zero T_PCLOSE { $$ = rofi_theme_property_create ( P_PADDING ); $$->name = $1; $$->value.padding = (RofiPadding){ $3, $4, $3, $4 }; } -| t_property_name T_PSEP t_property_distance t_property_distance t_property_distance T_PCLOSE { +| t_property_name T_PSEP t_property_distance_zero t_property_distance_zero t_property_distance_zero T_PCLOSE { $$ = rofi_theme_property_create ( P_PADDING ); $$->name = $1; $$->value.padding = (RofiPadding){ $3, $4, $5, $4 }; } -| t_property_name T_PSEP t_property_distance t_property_distance t_property_distance t_property_distance T_PCLOSE { +| t_property_name T_PSEP t_property_distance_zero t_property_distance_zero t_property_distance_zero t_property_distance_zero T_PCLOSE { $$ = rofi_theme_property_create ( P_PADDING ); $$->name = $1; $$->value.padding = (RofiPadding){ $3, $4, $5, $6 }; @@ -469,6 +470,15 @@ t_property_highlight_style | T_SMALLCAPS { $$ = ROFI_HL_SMALL_CAPS; } ; + +t_property_distance_zero +: T_INT t_property_line_style { + $$.distance = (double) $1; + $$.type = ROFI_PU_PX; + $$.style = $2; +} +| t_property_distance { $$ = $1;} +; /** Distance. */ t_property_distance /** Interger unit and line style */