From ad877bb2e6a8d80c1e23dc4094ef122933268c49 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 30 Oct 2017 17:06:11 +0100 Subject: [PATCH] [ThemeParser] Give a more detailed error when only 7 elements are specified in argb syntax. --- Changelog | 1 + lexer/theme-lexer.l | 3 +++ lexer/theme-parser.y | 1 + 3 files changed, 5 insertions(+) diff --git a/Changelog b/Changelog index 9bce46e7..4a810ad3 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ v1.4.3 (dev): + - Better error message on invalid argb syntax. - Fix default theme border. - Make '#' in the parser optional. - Update themes. diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index b906b59c..e7430355 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -474,6 +474,9 @@ if ( queue == NULL ){ yylval->colorval.green = rofi_theme_parse_convert_hex(yytext[9],yytext[10]); yylval->colorval.blue = rofi_theme_parse_convert_hex(yytext[11],yytext[12]); return T_COLOR; +} +argb:{HEX}{7} { + return T_ERROR_ARGB_SPEC; } /* Color schemes */ {RGBA} { return T_COL_RGBA; } diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index de2acf6f..c9714ff3 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -155,6 +155,7 @@ static ThemeColor hwb_to_rgb ( double h, double w, double b) %token T_ERROR_NAMESTRING 4 "invalid element name" %token T_ERROR_DEFAULTS 5 "invalid defaults name" %token T_ERROR_INCLUDE 6 "invalid import value" +%token T_ERROR_ARGB_SPEC 7 "invalid argb color. Requires 8 (not 7) elements: argb:AARRGGBB." %token T_INT "Integer number" %token T_DOUBLE "Floating-point number" %token T_STRING "UTF-8 encoded string"