cfgparse: eliminate absolute states, use yy_push_state/yy_pop_state
This fixes a problem with workspace assignments. I tested i3 -C with three user configs (Thanks SardemFF7, julien, xeen) and did not notice any problems.
This commit is contained in:
parent
12d866e4f6
commit
caee0a0fda
|
@ -136,7 +136,7 @@ EOL (\r?\n)
|
||||||
return STR;
|
return STR;
|
||||||
}
|
}
|
||||||
<WANT_STRING>[^\n]+ { yy_pop_state(); yylval.string = sstrdup(yytext); return STR; }
|
<WANT_STRING>[^\n]+ { yy_pop_state(); yylval.string = sstrdup(yytext); return STR; }
|
||||||
<OUTPUT_COND>[a-zA-Z0-9_-]+ { yylval.string = sstrdup(yytext); return OUTPUT; }
|
<OUTPUT_COND>[a-zA-Z0-9_-]+ { yy_pop_state(); yylval.string = sstrdup(yytext); return OUTPUT; }
|
||||||
^[ \t]*#[^\n]* { return TOKCOMMENT; }
|
^[ \t]*#[^\n]* { return TOKCOMMENT; }
|
||||||
<COLOR_COND>[0-9a-fA-F]+ { yylval.string = sstrdup(yytext); return HEX; }
|
<COLOR_COND>[0-9a-fA-F]+ { yylval.string = sstrdup(yytext); return HEX; }
|
||||||
<ASSIGN_TARGET_COND>[ \t]*→[ \t]* { BEGIN(WANT_STRING); }
|
<ASSIGN_TARGET_COND>[ \t]*→[ \t]* { BEGIN(WANT_STRING); }
|
||||||
|
@ -147,8 +147,8 @@ mode { return TOKMODE; }
|
||||||
bind { yy_push_state(WANT_STRING); yy_push_state(EAT_WHITESPACE); yy_push_state(EAT_WHITESPACE); return TOKBINDCODE; }
|
bind { yy_push_state(WANT_STRING); yy_push_state(EAT_WHITESPACE); yy_push_state(EAT_WHITESPACE); return TOKBINDCODE; }
|
||||||
bindcode { yy_push_state(WANT_STRING); yy_push_state(EAT_WHITESPACE); yy_push_state(EAT_WHITESPACE); return TOKBINDCODE; }
|
bindcode { yy_push_state(WANT_STRING); yy_push_state(EAT_WHITESPACE); yy_push_state(EAT_WHITESPACE); return TOKBINDCODE; }
|
||||||
bindsym { yy_push_state(BINDSYM_COND); yy_push_state(EAT_WHITESPACE); return TOKBINDSYM; }
|
bindsym { yy_push_state(BINDSYM_COND); yy_push_state(EAT_WHITESPACE); return TOKBINDSYM; }
|
||||||
floating_modifier { BEGIN(INITIAL); return TOKFLOATING_MODIFIER; }
|
floating_modifier { return TOKFLOATING_MODIFIER; }
|
||||||
workspace { BEGIN(INITIAL); return TOKWORKSPACE; }
|
workspace { return TOKWORKSPACE; }
|
||||||
output { yy_push_state(OUTPUT_COND); yy_push_state(EAT_WHITESPACE); return TOKOUTPUT; }
|
output { yy_push_state(OUTPUT_COND); yy_push_state(EAT_WHITESPACE); return TOKOUTPUT; }
|
||||||
terminal { WS_STRING; return TOKTERMINAL; }
|
terminal { WS_STRING; return TOKTERMINAL; }
|
||||||
font { WS_STRING; return TOKFONT; }
|
font { WS_STRING; return TOKFONT; }
|
||||||
|
@ -234,7 +234,6 @@ title { yy_push_state(WANT_QSTRING); return TOK_TITLE;
|
||||||
/* if ASSIGN_COND then */
|
/* if ASSIGN_COND then */
|
||||||
if (yy_start_stack_ptr > 0)
|
if (yy_start_stack_ptr > 0)
|
||||||
yy_pop_state();
|
yy_pop_state();
|
||||||
else BEGIN(INITIAL);
|
|
||||||
/* yylval will be the string, but without quotes */
|
/* yylval will be the string, but without quotes */
|
||||||
char *copy = sstrdup(yytext+1);
|
char *copy = sstrdup(yytext+1);
|
||||||
copy[strlen(copy)-1] = '\0';
|
copy[strlen(copy)-1] = '\0';
|
||||||
|
|
Loading…
Reference in New Issue