mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-06-07 03:29:29 +00:00
Allow string constants in initializers for arrays of char*.
For example, declarations like the following should be accepted:
char *p[] = {"abc", "def"};
This previously worked, but it was broken by commit 5871820e0c
.
This commit is contained in:
parent
c1b2a88a84
commit
7ac3fe6424
12
Parser.pas
12
Parser.pas
|
@ -2491,9 +2491,9 @@ var
|
|||
kind := ktp^.kind;
|
||||
|
||||
{handle string constants}
|
||||
if token.kind = stringConst then begin
|
||||
if token.kind = stringConst then
|
||||
stringElementType := StringType(token.prefix)^.aType;
|
||||
if (kind = scalarType) and
|
||||
if (token.kind = stringConst) and (kind = scalarType) and
|
||||
(((ktp^.baseType in [cgByte,cgUByte])
|
||||
and (stringElementType = charPtr))
|
||||
or CompTypes(ktp,stringElementType)) then begin
|
||||
|
@ -2541,14 +2541,8 @@ var
|
|||
end; {with}
|
||||
NextToken;
|
||||
end {if}
|
||||
else begin
|
||||
Error(47);
|
||||
errorFound := true;
|
||||
NextToken;
|
||||
end; {else}
|
||||
end {if}
|
||||
|
||||
{handle arrays of non-strings}
|
||||
{handle arrays not initialized with a string constant}
|
||||
else if kind in
|
||||
[scalarType,pointerType,enumType,arrayType,structType,unionType] then
|
||||
begin
|
||||
|
|
Loading…
Reference in New Issue
Block a user