]> git.sur5r.net Git - i3/i3/commitdiff
parser: Solve last shift/reduce conflicts
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 6 Nov 2009 16:26:17 +0000 (17:26 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 6 Nov 2009 16:26:17 +0000 (17:26 +0100)
src/cfgparse.y

index f212826e22c355dddc5e030ce2c94b31682d0499..8d980ced84303d1b8caffd8a9dcf278c96b12276 100644 (file)
@@ -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 = $<number>3;
                 if (ws_num < 1) {
@@ -380,7 +380,7 @@ workspace:
                                 workspace_set_name(ws, $<string>8);
                 }
         }
-        | TOKWORKSPACE WHITESPACE NUMBER workspace_name
+        | TOKWORKSPACE WHITESPACE NUMBER WHITESPACE workspace_name
         {
                 int ws_num = $<number>3;
                 if (ws_num < 1) {
@@ -392,10 +392,14 @@ workspace:
         }
         ;
 
+optional_workspace_name:
+        /* empty */                     { $<string>$ = NULL; }
+        | workspace_name                { $<string>$ = $<string>1; }
+        ;
+
 workspace_name:
-        /* NULL */                      { $<string>$ = NULL; }
-        | WHITESPACE QUOTEDSTRING       { $<string>$ = $<string>2; }
-        | WHITESPACE STR                { $<string>$ = $<string>2; }
+        QUOTEDSTRING         { $<string>$ = $<string>1; }
+        | STR                { $<string>$ = $<string>1; }
         ;
 
 screen: