Merge from trunk revision 1571: This patch fixes the parser to return

an error when variable declaration statements contain trailing commas,
instead of passing them through to STDOUT. It also adds parser
testcases demonstrating the issue.

Nominated-By: Steve Beattie <sbeattie@ubuntu.com>
This commit is contained in:
Steve Beattie 2011-01-14 16:53:51 -06:00
parent 7714b62889
commit d7e06b79bb
7 changed files with 66 additions and 0 deletions

View file

@ -377,6 +377,12 @@ LT_EQUAL <=
return TOK_VALUE;
}
{END_OF_RULE} {
DUMP_PREPROCESS;
yylval.id = strdup(yytext);
yyerror(_("Variable declarations do not accept trailing commas"));
}
\\\n { DUMP_PREPROCESS; current_lineno++ ; }
\r?\n {

View file

@ -0,0 +1,10 @@
#=DESCRIPTION trailing commas should trigger an error
#=EXRESULT FAIL
@{LIBVIRT} = libvirt,
/does/not/exist {
change_profile ->
@{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,
}

View file

@ -0,0 +1,10 @@
#=DESCRIPTION trailing commas should trigger an error
#=EXRESULT FAIL
@{LIBVIRT} = libvirt libtriv,
/does/not/exist {
change_profile ->
@{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,
}

View file

@ -0,0 +1,10 @@
#=DESCRIPTION trailing commas should trigger an error
#=EXRESULT FAIL
@{LIBVIRT} = libvirt, libtriv,
/does/not/exist {
change_profile ->
@{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,
}

View file

@ -0,0 +1,10 @@
#=DESCRIPTION trailing commas should trigger an error
#=EXRESULT FAIL
@{LIBVIRT} = libvirt, libtriv
/does/not/exist {
change_profile ->
@{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,
}

View file

@ -0,0 +1,10 @@
#=DESCRIPTION quoted commas should not trigger an error
#=EXRESULT PASS
@{LIBVIRT} = "libvirt,"
/does/not/exist {
change_profile ->
@{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,
}

View file

@ -0,0 +1,10 @@
#=DESCRIPTION quoted commas should not trigger an error
#=EXRESULT PASS
@{LIBVIRT} = "libvirt, libtriv"
/does/not/exist {
change_profile ->
@{LIBVIRT}-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*-[0-9a-f]*,
}