X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcfgparse.l;h=6eef8a5ae6920d903a8ade3243ff5037b5fb8f9e;hb=d2b533328d4b9f6148dfe1997ae8517d6ea0ca68;hp=ab0c0d54688094163e305b325344143b18a6f310;hpb=1f6fbaf240351a3559f25bc47286c47b29c1047f;p=i3%2Fi3 diff --git a/src/cfgparse.l b/src/cfgparse.l index ab0c0d54..6eef8a5a 100644 --- a/src/cfgparse.l +++ b/src/cfgparse.l @@ -37,7 +37,8 @@ int yycolumn = 1; yy_push_state(EAT_WHITESPACE); \ } while (0) -#define BAR_DOUBLE_COLOR do { \ +#define BAR_TRIPLE_COLOR do { \ + yy_push_state(BAR_COLOR); \ yy_push_state(BAR_COLOR); \ yy_push_state(BAR_COLOR); \ } while (0) @@ -55,15 +56,18 @@ EOL (\r?\n) %s OUTPUT_COND %s FOR_WINDOW_COND %s EAT_WHITESPACE +%s BORDER_WIDTH %x BUFFER_LINE %x BAR %x BAR_MODE +%x BAR_MODIFIER %x BAR_POSITION %x BAR_COLORS %x BAR_COLOR %x EXEC +%x OPTRELEASE %% @@ -88,7 +92,7 @@ EOL (\r?\n) } /* This part of the lexer handles the bar {} blocks */ -[ \t]+ { /* ignore whitespace */ ; } +[ \t]+ { /* ignore whitespace */ ; } "{" { return '{'; } "}" { yy_pop_state(); return '}'; } ^[ \t]*#[^\n]* { return TOKCOMMENT; } @@ -98,10 +102,20 @@ EOL (\r?\n) mode { yy_push_state(BAR_MODE); return TOK_BAR_MODE; } hide { yy_pop_state(); return TOK_BAR_HIDE; } dock { yy_pop_state(); return TOK_BAR_DOCK; } +modifier { yy_push_state(BAR_MODIFIER); return TOK_BAR_MODIFIER; } +control { yy_pop_state(); return TOK_BAR_CONTROL; } +ctrl { yy_pop_state(); return TOK_BAR_CONTROL; } +shift { yy_pop_state(); return TOK_BAR_SHIFT; } +Mod1 { yy_pop_state(); return TOK_BAR_MOD1; } +Mod2 { yy_pop_state(); return TOK_BAR_MOD2; } +Mod3 { yy_pop_state(); return TOK_BAR_MOD3; } +Mod4 { yy_pop_state(); return TOK_BAR_MOD4; } +Mod5 { yy_pop_state(); return TOK_BAR_MOD5; } position { yy_push_state(BAR_POSITION); return TOK_BAR_POSITION; } bottom { yy_pop_state(); return TOK_BAR_BOTTOM; } top { yy_pop_state(); return TOK_BAR_TOP; } status_command { WS_STRING; return TOK_BAR_STATUS_COMMAND; } +i3bar_command { WS_STRING; return TOK_BAR_I3BAR_COMMAND; } font { WS_STRING; return TOK_BAR_FONT; } workspace_buttons { return TOK_BAR_WORKSPACE_BUTTONS; } verbose { return TOK_BAR_VERBOSE; } @@ -111,12 +125,18 @@ EOL (\r?\n) ^[ \t]*#[^\n]* { return TOKCOMMENT; } background { yy_push_state(BAR_COLOR); return TOK_BAR_COLOR_BACKGROUND; } statusline { yy_push_state(BAR_COLOR); return TOK_BAR_COLOR_STATUSLINE; } -focused_workspace { BAR_DOUBLE_COLOR; return TOK_BAR_COLOR_FOCUSED_WORKSPACE; } -active_workspace { BAR_DOUBLE_COLOR; return TOK_BAR_COLOR_ACTIVE_WORKSPACE; } -inactive_workspace { BAR_DOUBLE_COLOR; return TOK_BAR_COLOR_INACTIVE_WORKSPACE; } -urgent_workspace { BAR_DOUBLE_COLOR; return TOK_BAR_COLOR_URGENT_WORKSPACE; } +focused_workspace { BAR_TRIPLE_COLOR; return TOK_BAR_COLOR_FOCUSED_WORKSPACE; } +active_workspace { BAR_TRIPLE_COLOR; return TOK_BAR_COLOR_ACTIVE_WORKSPACE; } +inactive_workspace { BAR_TRIPLE_COLOR; return TOK_BAR_COLOR_INACTIVE_WORKSPACE; } +urgent_workspace { BAR_TRIPLE_COLOR; return TOK_BAR_COLOR_URGENT_WORKSPACE; } #[0-9a-fA-F]+ { yy_pop_state(); yylval.string = sstrdup(yytext); return HEXCOLOR; } -[a-zA-Z]+ { yylval.string = sstrdup(yytext); return WORD; } +{EOL} { + yy_pop_state(); + FREE(context->line_copy); + context->line_number++; + yy_push_state(BUFFER_LINE); + } +[a-zA-Z]+ { yylval.string = sstrdup(yytext); return WORD; } @@ -141,19 +161,30 @@ EOL (\r?\n) return STR; } [^\n]+ { yy_pop_state(); yylval.string = sstrdup(yytext); return STR; } -[a-zA-Z0-9_-]+ { yy_pop_state(); yylval.string = sstrdup(yytext); return OUTPUT; } +[a-zA-Z0-9\/_-]+ { yy_pop_state(); yylval.string = sstrdup(yytext); return OUTPUT; } ^[ \t]*#[^\n]* { return TOKCOMMENT; } #[0-9a-fA-F]+ { yy_pop_state(); yylval.string = sstrdup(yytext); return HEXCOLOR; } +{EOL} { + yy_pop_state(); + FREE(context->line_copy); + context->line_number++; + yy_push_state(BUFFER_LINE); + } [ \t]*→[ \t]* { BEGIN(WANT_STRING); } [ \t]+ { BEGIN(WANT_STRING); } +[^\n][0-9]+ { printf("Border width set to: %s\n", yytext); yylval.number = atoi(yytext); return NUMBER;} --no-startup-id { printf("no startup id\n"); yy_pop_state(); return TOK_NO_STARTUP_ID; } . { printf("anything else: *%s*\n", yytext); yyless(0); yy_pop_state(); yy_pop_state(); } -[0-9]+ { yylval.number = atoi(yytext); return NUMBER; } +--release { printf("--release\n"); yy_pop_state(); return TOK_RELEASE; } +. { printf("anything else (optrelease): *%s*\n", yytext); yyless(0); yy_pop_state(); yy_pop_state(); } +[0-9-]+ { yylval.number = atoi(yytext); return NUMBER; } bar { yy_push_state(BAR); return TOK_BAR; } mode { return TOKMODE; } 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; } -bindsym { yy_push_state(BINDSYM_COND); yy_push_state(EAT_WHITESPACE); return TOKBINDSYM; } +bindcode { yy_push_state(WANT_STRING); yy_push_state(EAT_WHITESPACE); yy_push_state(EAT_WHITESPACE); yy_push_state(OPTRELEASE); yy_push_state(EAT_WHITESPACE); return TOKBINDCODE; } +bindsym { yy_push_state(BINDSYM_COND); yy_push_state(EAT_WHITESPACE); yy_push_state(OPTRELEASE); yy_push_state(EAT_WHITESPACE); return TOKBINDSYM; } +floating_maximum_size { return TOKFLOATING_MAXIMUM_SIZE; } +floating_minimum_size { return TOKFLOATING_MINIMUM_SIZE; } floating_modifier { return TOKFLOATING_MODIFIER; } workspace { return TOKWORKSPACE; } output { yy_push_state(OUTPUT_COND); yy_push_state(EAT_WHITESPACE); return TOKOUTPUT; } @@ -171,13 +202,21 @@ auto { return TOK_AUTO; } workspace_layout { return TOK_WORKSPACE_LAYOUT; } new_window { return TOKNEWWINDOW; } new_float { return TOKNEWFLOAT; } -normal { return TOK_NORMAL; } +normal { yy_push_state(BORDER_WIDTH); return TOK_NORMAL; } none { return TOK_NONE; } 1pixel { return TOK_1PIXEL; } +pixel { yy_push_state(BORDER_WIDTH); return TOK_PIXEL; } +hide_edge_borders { return TOK_HIDE_EDGE_BORDERS; } +both { return TOK_BOTH; } focus_follows_mouse { return TOKFOCUSFOLLOWSMOUSE; } force_focus_wrapping { return TOK_FORCE_FOCUS_WRAPPING; } force_xinerama { return TOK_FORCE_XINERAMA; } +force-xinerama { return TOK_FORCE_XINERAMA; } +fake_outputs { WS_STRING; return TOK_FAKE_OUTPUTS; } +fake-outputs { WS_STRING; return TOK_FAKE_OUTPUTS; } workspace_auto_back_and_forth { return TOK_WORKSPACE_AUTO_BAF; } +force_display_urgency_hint { return TOK_WORKSPACE_URGENCY_TIMER; } +ms { return TOK_TIME_MS; } workspace_bar { return TOKWORKSPACEBAR; } popup_during_fullscreen { return TOK_POPUP_DURING_FULLSCREEN; } ignore { return TOK_IGNORE; } @@ -204,10 +243,10 @@ rows { /* yylval.number = STACK_LIMIT_ROWS; */return exec { WS_STRING; yy_push_state(EXEC); yy_push_state(EAT_WHITESPACE); return TOKEXEC; } exec_always { WS_STRING; yy_push_state(EXEC); yy_push_state(EAT_WHITESPACE); return TOKEXEC_ALWAYS; } client.background { yy_push_state(COLOR_COND); yylval.single_color = &config.client.background; return TOKSINGLECOLOR; } -client.focused { yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yylval.color = &config.client.focused; return TOKCOLOR; } -client.focused_inactive { yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yylval.color = &config.client.focused_inactive; return TOKCOLOR; } -client.unfocused { yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yylval.color = &config.client.unfocused; return TOKCOLOR; } -client.urgent { yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yylval.color = &config.client.urgent; return TOKCOLOR; } +client.focused { yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yylval.color = &config.client.focused; return TOKCOLOR; } +client.focused_inactive { yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yylval.color = &config.client.focused_inactive; return TOKCOLOR; } +client.unfocused { yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yylval.color = &config.client.unfocused; return TOKCOLOR; } +client.urgent { yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yy_push_state(COLOR_COND); yylval.color = &config.client.urgent; return TOKCOLOR; } bar.focused { yy_push_state(COLOR_COND); yylval.color = &config.bar.focused; return TOKCOLOR; } bar.unfocused { yy_push_state(COLOR_COND); yylval.color = &config.bar.unfocused; return TOKCOLOR; } bar.urgent { yy_push_state(COLOR_COND); yylval.color = &config.bar.urgent; return TOKCOLOR; } @@ -228,6 +267,7 @@ id { yy_push_state(WANT_QSTRING); return TOK_ID; } con_id { yy_push_state(WANT_QSTRING); return TOK_CON_ID; } con_mark { yy_push_state(WANT_QSTRING); return TOK_MARK; } title { yy_push_state(WANT_QSTRING); return TOK_TITLE; } +urgent { yy_push_state(WANT_QSTRING); return TOK_URGENT; } <*>{EOL} { FREE(context->line_copy);