diff options
author | Dave Davenport <qball@gmpclient.org> | 2020-04-23 21:18:25 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2020-04-23 21:18:25 +0200 |
commit | 15b0f39acd046ddfdbfce8b2f9c8cfb60cabf093 (patch) | |
tree | 54620a4163c81663dca357c7ee29d2f67b110422 | |
parent | 7fdf1af7e482c43416534216f72df66ad795ff41 (diff) |
[Theme] use calc() syntax.
-rw-r--r-- | lexer/theme-lexer.l | 2 | ||||
-rw-r--r-- | lexer/theme-parser.y | 36 |
2 files changed, 28 insertions, 10 deletions
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index f0b68048..800878a9 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -227,6 +227,7 @@ COLOR_TRANSPARENT (?i:transparent) S_T_PARENT_LEFT \( S_T_PARENT_RIGHT \) +CALC (?i:calc) COMMA , FORWARD_SLASH \/ @@ -455,6 +456,7 @@ if ( queue == NULL ){ <PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{INHERIT} { return T_INHERIT; } <PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{MODIFIER_ADD} { return T_MODIFIER_ADD; } <PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{MODIFIER_SUBTRACT} { return T_MODIFIER_SUBTRACT; } +<PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{CALC} { return T_CALC; } <PROPERTIES,PROPERTIES_ENV,PROPERTIES_VAR_DEFAULT>{ENV} { yytext[yyleng-1] = '\0'; diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index 0eb1bd73..5f5ad174 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -214,6 +214,8 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %token T_MODIFIER_ADD "Add ('+')" %token T_MODIFIER_SUBTRACT "Subtract ('-')" +%token T_CALC "calc" + %token T_BOPEN "bracket open ('{')" %token T_BCLOSE "bracket close ('}')" %token T_PSEP "property separator (':')" @@ -666,19 +668,33 @@ t_property_distance $$.base.modifier = NULL; $$.style = $3; } -| T_INT t_property_unit t_property_distance_unit t_property_line_style { - $$.base.distance = (double)$1; - $$.base.type = $2; - $$.base.modifier = $3; +| T_CALC T_PARENT_LEFT T_INT t_property_unit T_PARENT_RIGHT t_property_line_style { + $$.base.distance = (double)$3; + $$.base.type = $4; + $$.base.modifier = NULL; $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE; - $$.style = $4; + $$.style = $6; } -| T_DOUBLE t_property_unit t_property_distance_unit t_property_line_style { - $$.base.distance = (double)$1; - $$.base.type = $2; - $$.base.modifier = $3; +| T_CALC T_PARENT_LEFT T_DOUBLE t_property_unit T_PARENT_RIGHT t_property_line_style { + $$.base.distance = (double)$3; + $$.base.type = $4; + $$.base.modifier = NULL; + $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE; + $$.style = $6; +} +| T_CALC T_PARENT_LEFT T_INT t_property_unit t_property_distance_unit T_PARENT_RIGHT t_property_line_style { + $$.base.distance = (double)$3; + $$.base.type = $4; + $$.base.modifier = $5; + $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE; + $$.style = $7; +} +| T_CALC T_PARENT_LEFT T_DOUBLE t_property_unit t_property_distance_unit T_PARENT_RIGHT t_property_line_style { + $$.base.distance = (double)$3; + $$.base.type = $4; + $$.base.modifier = $5; $$.base.modtype = ROFI_DISTANCE_MODIFIER_NONE; - $$.style = $4; + $$.style = $7; }; /** distance unit. px, em, % */ |