From 9bfe6a6236ca733a4fc4e072b5014e01d430bfd9 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 19 Feb 2013 00:27:55 +0100 Subject: [PATCH] =?UTF-8?q?Bugfix:=20Properly=20parse=20commands=20like=20?= =?UTF-8?q?=E2=80=9Cmove=20workspace=20torrent=E2=80=9D=20(Thanks=20rasi)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #955 --- generate-command-parser.pl | 6 +++--- parser-specs/commands.spec | 2 +- testcases/t/187-commands-parser.t | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/generate-command-parser.pl b/generate-command-parser.pl index 5cdebf34..b76d5e55 100755 --- a/generate-command-parser.pl +++ b/generate-command-parser.pl @@ -84,14 +84,14 @@ for my $line (@lines) { # Cleanup the identifier (if any). $identifier =~ s/^\s*(\S+)\s*=\s*$/$1/g; - # Cleanup the tokens (remove whitespace). - $tokens =~ s/\s*//g; - # The default action is to stay in the current state. $action = $current_state if length($action) == 0; #say "identifier = *$identifier*, token = *$tokens*, action = *$action*"; for my $token (split(',', $tokens)) { + # Cleanup trailing/leading whitespace. + $token =~ s/^\s*//g; + $token =~ s/\s*$//g; my $store_token = { token => $token, identifier => $identifier, diff --git a/parser-specs/commands.spec b/parser-specs/commands.spec index 740c83ac..a4a01a88 100644 --- a/parser-specs/commands.spec +++ b/parser-specs/commands.spec @@ -262,7 +262,7 @@ state MOVE_DIRECTION_PX: -> call cmd_move_direction($direction, $pixels) state MOVE_WORKSPACE: - 'to' + 'to ' -> MOVE_WORKSPACE_TO_OUTPUT workspace = 'next_on_output', 'prev_on_output', 'next', 'prev', 'current' -> call cmd_move_con_to_workspace($workspace) diff --git a/testcases/t/187-commands-parser.t b/testcases/t/187-commands-parser.t index 37deb942..52070d56 100644 --- a/testcases/t/187-commands-parser.t +++ b/testcases/t/187-commands-parser.t @@ -52,6 +52,8 @@ is(parser_calls( 'move window to workspace 3; ' . 'move container to workspace 3; ' . 'move workspace foobar; ' . + 'move workspace torrent; ' . + 'move workspace to output LVDS1; ' . 'move workspace 3: foobar; ' . 'move workspace "3: foobar"; ' . 'move workspace "3: foobar, baz"; '), @@ -59,6 +61,8 @@ is(parser_calls( "cmd_move_con_to_workspace_name(3)\n" . "cmd_move_con_to_workspace_name(3)\n" . "cmd_move_con_to_workspace_name(foobar)\n" . + "cmd_move_con_to_workspace_name(torrent)\n" . + "cmd_move_workspace_to_output(LVDS1)\n" . "cmd_move_con_to_workspace_name(3: foobar)\n" . "cmd_move_con_to_workspace_name(3: foobar)\n" . "cmd_move_con_to_workspace_name(3: foobar, baz)",