Merge pull request #142 from VoiDeD/array-commas
Allow trailing commas in string array declarations. (bug 6239)
This commit is contained in:
commit
a136049392
@ -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) {
|
||||
|
20
sourcepawn/compiler/tests/ok-trailing-comma-in-literal.sp
Normal file
20
sourcepawn/compiler/tests/ok-trailing-comma-in-literal.sp
Normal 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 ] );
|
||||
}
|
Loading…
Reference in New Issue
Block a user