Bugfix: Correct string/quoted string parsing for the commands exec, workspace, nop, restore and mark (Thanks SardemFF7)
Fixes: #380
This commit is contained in:
parent
2e75d934a4
commit
94646190aa
|
@ -65,16 +65,16 @@ EOL (\r?\n)
|
||||||
cmdyycolumn = 1;
|
cmdyycolumn = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
<WANT_STRING>[^\n]+ { BEGIN(INITIAL); cmdyylval.string = sstrdup(yytext); return STR; }
|
|
||||||
<WANT_WS_STRING>[ \t]* { BEGIN(WANT_STRING); return WHITESPACE; }
|
<WANT_WS_STRING>[ \t]* { BEGIN(WANT_STRING); return WHITESPACE; }
|
||||||
<WANT_QSTRING>\"[^\"]+\" {
|
<WANT_STRING>\"[^\"]+\" {
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
/* strip quotes */
|
/* strip quotes */
|
||||||
char *copy = sstrdup(yytext+1);
|
char *copy = sstrdup(yytext+1);
|
||||||
copy[strlen(copy)-1] = '\0';
|
copy[strlen(copy)-1] = '\0';
|
||||||
cmdyylval.string = copy;
|
cmdyylval.string = copy;
|
||||||
return STR;
|
return STR;
|
||||||
}
|
}
|
||||||
|
<WANT_STRING>[^;\n]+ { BEGIN(INITIAL); cmdyylval.string = sstrdup(yytext); return STR; }
|
||||||
|
|
||||||
[ \t]* { return WHITESPACE; }
|
[ \t]* { return WHITESPACE; }
|
||||||
attach { return TOK_ATTACH; }
|
attach { return TOK_ATTACH; }
|
||||||
|
|
|
@ -30,6 +30,27 @@ multiple_cmds("kill\t ;\tkill");
|
||||||
multiple_cmds("kill\t ;\t kill");
|
multiple_cmds("kill\t ;\t kill");
|
||||||
multiple_cmds("kill \t ; \t kill");
|
multiple_cmds("kill \t ; \t kill");
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# test if un-quoted strings are handled correctly
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
$tmp = fresh_workspace;
|
||||||
|
cmd 'open';
|
||||||
|
my $unused = get_unused_workspace;
|
||||||
|
ok(!($unused ~~ @{get_workspace_names()}), 'workspace does not exist yet');
|
||||||
|
cmd "move workspace $unused; nop parser test";
|
||||||
|
ok(($unused ~~ @{get_workspace_names()}), 'workspace exists after moving');
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
# quote the workspace name and use a ; (command separator) in its name
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
$unused = get_unused_workspace;
|
||||||
|
$unused .= ';a';
|
||||||
|
ok(!($unused ~~ @{get_workspace_names()}), 'workspace does not exist yet');
|
||||||
|
cmd qq|move workspace "$unused"; nop parser test|;
|
||||||
|
ok(($unused ~~ @{get_workspace_names()}), 'workspace exists after moving');
|
||||||
|
|
||||||
# TODO: need a non-invasive command before implementing a test which uses ','
|
# TODO: need a non-invasive command before implementing a test which uses ','
|
||||||
|
|
||||||
done_testing;
|
done_testing;
|
||||||
|
|
Loading…
Reference in New Issue