mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2026-04-24 06:21:13 +00:00
Handle function-typed parameters whose own params start with attributes.
The parsing logic for unnamed parameters sometimes needs to look ahead an extra token to account for this. Here are examples of function declarations affected by this logic, as well as equivalent and compatible ways of declaring the same functions: int f(int([[]] int)); int f(int (*)(int)); int g(int([])); int g(int*);
This commit is contained in:
+18
@@ -1518,6 +1518,23 @@ var
|
||||
unnamedParm := true;
|
||||
end; {MakeUnnamedParameter}
|
||||
|
||||
|
||||
function PeekToken: tokenEnum;
|
||||
|
||||
{ peek at next token and get its kind }
|
||||
|
||||
var
|
||||
tToken: tokenType; {temporary copy of current token}
|
||||
|
||||
begin {PeekToken}
|
||||
tToken := token;
|
||||
NextToken;
|
||||
PeekToken := token.kind;
|
||||
PutBackToken(token, false, true);
|
||||
token := tToken;
|
||||
end; {PeekToken}
|
||||
|
||||
|
||||
begin {StackDeclarations}
|
||||
lastWasIdentifier := false; {used to see if the declaration is a fn}
|
||||
cpList := nil;
|
||||
@@ -1588,6 +1605,7 @@ var
|
||||
NextToken;
|
||||
if doingPrototypes
|
||||
and (token.kind in prototypeParameterDeclarationStart)
|
||||
and ((token.kind <> lbrackch) or (PeekToken = lbrackch))
|
||||
then begin { unnamed param declared with fn type }
|
||||
PutBackToken(token, false, true);
|
||||
token.kind := lparench;
|
||||
|
||||
Reference in New Issue
Block a user