Merge pull request #142 from VoiDeD/array-commas

Allow trailing commas in string array declarations. (bug 6239)
This commit is contained in:
David Anderson 2014-08-29 11:21:14 -04:00
commit a136049392
2 changed files with 25 additions and 2 deletions

View File

@ -2720,8 +2720,11 @@ static cell initvector(int ident,int tag,cell size,int fillzero,
} while (matchtoken(',')); /* do */
needtoken('}');
} else {
init(ident,&ctag,errorfound);
matchtag(tag,ctag,TRUE);
if (!lexpeek('}'))
{
init(ident,&ctag,errorfound);
matchtag(tag,ctag,TRUE);
}
} /* if */
/* fill up the literal queue with a series */
if (ellips) {

View File

@ -0,0 +1,20 @@
new String:oldArray[][] =
{
"string",
"string2",
};
char newArray[][] =
{
"another string",
"more strings",
};
native Print( const String:string[] );
public OnPluginStart()
{
Print( oldArray[ 0 ] );
Print( newArray[ 0 ] );
}