]> git.sur5r.net Git - i3/i3/blobdiff - src/cfgparse.l
Bugfix: properly handle comments in colors {} blocks of bar config (+test) (Thanks...
[i3/i3] / src / cfgparse.l
index 39e1d3988c15e51fd6e4a910d25b6fca9064aa6e..1f584c327196476b31511391599885d3ef76c0ed 100644 (file)
@@ -13,9 +13,9 @@
 #include <stdint.h>
 #include <xcb/xcb.h>
 
+#include "log.h"
 #include "data.h"
 #include "config.h"
-#include "log.h"
 #include "util.h"
 #include "libi3.h"
 
@@ -106,13 +106,14 @@ EOL     (\r?\n)
 <BAR>colors                     { yy_push_state(BAR_COLORS); return TOK_BAR_COLORS; }
 <BAR_COLORS>"{"                 { return '{'; }
 <BAR_COLORS>"}"                 { yy_pop_state(); return '}'; }
+<BAR_COLORS>^[ \t]*#[^\n]*      { return TOKCOMMENT; }
 <BAR_COLORS>background          { yy_push_state(BAR_COLOR); return TOK_BAR_COLOR_BACKGROUND; }
 <BAR_COLORS>statusline          { yy_push_state(BAR_COLOR); return TOK_BAR_COLOR_STATUSLINE; }
 <BAR_COLORS>focused_workspace   { BAR_DOUBLE_COLOR; return TOK_BAR_COLOR_FOCUSED_WORKSPACE; }
 <BAR_COLORS>active_workspace    { BAR_DOUBLE_COLOR; return TOK_BAR_COLOR_ACTIVE_WORKSPACE; }
 <BAR_COLORS>inactive_workspace  { BAR_DOUBLE_COLOR; return TOK_BAR_COLOR_INACTIVE_WORKSPACE; }
 <BAR_COLORS>urgent_workspace    { BAR_DOUBLE_COLOR; return TOK_BAR_COLOR_URGENT_WORKSPACE; }
-<BAR_COLOR>#[0-9a-fA-F]+        { yy_pop_state(); yylval.string = sstrdup(yytext+1); return HEXCOLOR; }
+<BAR_COLOR>#[0-9a-fA-F]+        { yy_pop_state(); yylval.string = sstrdup(yytext); return HEXCOLOR; }
 <BAR,BAR_COLORS,BAR_MODE,BAR_POSITION>[a-zA-Z]+ { yylval.string = sstrdup(yytext); return WORD; }
 
 
@@ -138,7 +139,7 @@ EOL     (\r?\n)
 <WANT_STRING>[^\n]+             { yy_pop_state(); yylval.string = sstrdup(yytext); return STR; }
 <OUTPUT_COND>[a-zA-Z0-9_-]+     { yy_pop_state(); yylval.string = sstrdup(yytext); return OUTPUT; }
 ^[ \t]*#[^\n]*                  { return TOKCOMMENT; }
-<COLOR_COND>#[0-9a-fA-F]+       { yy_pop_state(); yylval.string = sstrdup(yytext+1); return HEXCOLOR; }
+<COLOR_COND>#[0-9a-fA-F]+       { yy_pop_state(); yylval.string = sstrdup(yytext); return HEXCOLOR; }
 <ASSIGN_TARGET_COND>[ \t]*→[ \t]*     { BEGIN(WANT_STRING); }
 <ASSIGN_TARGET_COND>[ \t]+      { BEGIN(WANT_STRING); }
 [0-9]+                          { yylval.number = atoi(yytext); return NUMBER; }