From: Michael Stapelberg Date: Fri, 6 Nov 2009 16:26:17 +0000 (+0100) Subject: parser: Solve last shift/reduce conflicts X-Git-Tag: 3.d~18 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5583dfa5e4a25bd9b7838fab694e0e800ea80898;p=i3%2Fi3 parser: Solve last shift/reduce conflicts --- diff --git a/src/cfgparse.y b/src/cfgparse.y index f212826e..8d980ced 100644 --- a/src/cfgparse.y +++ b/src/cfgparse.y @@ -368,7 +368,7 @@ new_container: ; workspace: - TOKWORKSPACE WHITESPACE NUMBER WHITESPACE TOKSCREEN WHITESPACE screen workspace_name + TOKWORKSPACE WHITESPACE NUMBER WHITESPACE TOKSCREEN WHITESPACE screen optional_workspace_name { int ws_num = $3; if (ws_num < 1) { @@ -380,7 +380,7 @@ workspace: workspace_set_name(ws, $8); } } - | TOKWORKSPACE WHITESPACE NUMBER workspace_name + | TOKWORKSPACE WHITESPACE NUMBER WHITESPACE workspace_name { int ws_num = $3; if (ws_num < 1) { @@ -392,10 +392,14 @@ workspace: } ; +optional_workspace_name: + /* empty */ { $$ = NULL; } + | workspace_name { $$ = $1; } + ; + workspace_name: - /* NULL */ { $$ = NULL; } - | WHITESPACE QUOTEDSTRING { $$ = $2; } - | WHITESPACE STR { $$ = $2; } + QUOTEDSTRING { $$ = $1; } + | STR { $$ = $1; } ; screen: