diff options
author | Dave Davenport <qball@gmpclient.org> | 2016-12-11 12:19:46 +0100 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2016-12-11 12:19:46 +0100 |
commit | 1dfac3c4da2d1b52a3d1521b1501d8421c139d07 (patch) | |
tree | 0dc84d1fc479bc6607b97aef67b0d9aaa98611ca /lexer | |
parent | 5fd76b75b1e1e0d72f7bb821ac5db5bca4be10b7 (diff) |
Update to new theme
Diffstat (limited to 'lexer')
-rw-r--r-- | lexer/theme-lexer.l | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index 90e66b39..8a747545 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -24,13 +24,22 @@ int yylex(void); (true|false) { yylval.bval= g_strcmp0(yytext, "true") == 0; return T_BOOLEAN;} [_\-a-zA-Z0-9]+ { yylval.sval = g_strdup(yytext); return N_STRING;} \"[_\-a-zA-Z0-9 \t]+\" { yytext[yyleng-1] = '\0'; yylval.sval = g_strdup(&yytext[1]); return T_STRING;} -#[0-9A-Fa-f]+ { - union { unsigned int val; struct { unsigned char a,r,g,b;};} val; +#[0-9A-Fa-f]{8} { + union { unsigned int val; struct { unsigned char b,g,r,a;};} val; val.val = (unsigned int)strtoull ( &yytext[1], NULL, 16); yylval.colorval.alpha = val.a/255.0; - yylval.colorval.red = val.r/255.0; + yylval.colorval.red = val.r/255.0; yylval.colorval.green = val.g/255.0; - yylval.colorval.blue = val.b/255.0; + yylval.colorval.blue = val.b/255.0; + return T_COLOR; +} +#[0-9A-Fa-f]{6} { + union { unsigned int val; struct { unsigned char b,g,r,a;};} val; + val.val = (unsigned int)strtoull ( &yytext[1], NULL, 16); + yylval.colorval.alpha = 1.0; + yylval.colorval.red = val.r/255.0; + yylval.colorval.green = val.g/255.0; + yylval.colorval.blue = val.b/255.0; return T_COLOR; } [\r\n]+ ; |