mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-02 04:31:25 +00:00
Parse ... as a single punctuator token.
This accords with its definition in the C standards. For the time being, the old form of three separate tokens is still accepted too, because the ... token may not be scanned correctly in the obscure case where there is a line continuation between the second and third dots. One observable effect of this is that there are no longer spaces between the dots in #pragma expand output.
This commit is contained in:
parent
f263066f61
commit
4fe9c90942
@ -195,7 +195,7 @@ type
|
||||
lteqop,gteqop,eqeqop,exceqop,andandop,
|
||||
barbarop,pluseqop,minuseqop,asteriskeqop,slasheqop,
|
||||
percenteqop,ltlteqop,gtgteqop,andeqop,caroteqop,
|
||||
bareqop,poundpoundop,
|
||||
bareqop,poundpoundop,dotdotdotsy,
|
||||
eolsy,eofsy, {control characters}
|
||||
typedef, {user types}
|
||||
uminus,uand,uasterisk, {converted operations}
|
||||
|
@ -18,7 +18,7 @@ uses CCommon, MM, Scanner, Symbol, CGI;
|
||||
{$segment 'SCANNER'}
|
||||
|
||||
const
|
||||
symFileVersion = 28; {version number of .sym file format}
|
||||
symFileVersion = 29; {version number of .sym file format}
|
||||
|
||||
var
|
||||
inhibitHeader: boolean; {should .sym includes be blocked?}
|
||||
|
@ -1500,13 +1500,18 @@ var
|
||||
end; {if}
|
||||
if token.kind = commach then begin
|
||||
NextToken;
|
||||
if token.kind = dotch then begin
|
||||
if token.kind = dotdotdotsy then begin
|
||||
NextToken;
|
||||
varargs := true;
|
||||
done2 := true;
|
||||
end {if}
|
||||
else if token.kind = dotch then begin
|
||||
NextToken;
|
||||
Match(dotch,89);
|
||||
Match(dotch,89);
|
||||
varargs := true;
|
||||
done2 := true;
|
||||
end; {if}
|
||||
end; {else if}
|
||||
end {if}
|
||||
else
|
||||
done2 := true;
|
||||
|
14
Scanner.pas
14
Scanner.pas
@ -1039,6 +1039,8 @@ case token.kind of
|
||||
else
|
||||
write('%:%:');
|
||||
|
||||
dotdotdotsy: write('...');
|
||||
|
||||
macroParm: write('$', token.pnum:1);
|
||||
|
||||
parameteroper,
|
||||
@ -2583,7 +2585,10 @@ var
|
||||
done := false;
|
||||
end; {if}
|
||||
end {if}
|
||||
else if token.kind = dotch then begin
|
||||
else if token.kind in [dotch,dotdotdotsy] then begin
|
||||
if token.kind = dotdotdotsy then
|
||||
NextToken
|
||||
else begin
|
||||
NextToken;
|
||||
if token.kind = dotch then begin
|
||||
NextToken;
|
||||
@ -2594,6 +2599,7 @@ var
|
||||
end
|
||||
else
|
||||
Error(89);
|
||||
end; {else}
|
||||
new(np);
|
||||
np^.next := nil;
|
||||
np^.str := '__VA_ARGS__';
|
||||
@ -5229,6 +5235,12 @@ case charKinds[ord(ch)] of
|
||||
DoNumber(false)
|
||||
else begin
|
||||
NextCh;
|
||||
if (ch = '.') and (chPtr <> eofPtr) and (chr(chPtr^) = '.') then begin
|
||||
token.kind := dotdotdotsy;
|
||||
NextCh;
|
||||
NextCh;
|
||||
end {if}
|
||||
else
|
||||
token.kind := dotch;
|
||||
end; {else}
|
||||
end;
|
||||
|
@ -308,7 +308,7 @@ charSym start single character symbols
|
||||
enum (lteqop,gteqop,eqeqop,exceqop,andandop)
|
||||
enum (barbarop,pluseqop,minuseqop,asteriskeqop,slasheqop)
|
||||
enum (percenteqop,ltlteqop,gtgteqop,andeqop,caroteqop)
|
||||
enum (bareqop,poundpoundop)
|
||||
enum (bareqop,poundpoundop,dotdotdotsy)
|
||||
enum (eolsy,eofsy) control characters
|
||||
enum (typedef) user types
|
||||
enum (uminus,uand,uasterisk) converted operations
|
||||
@ -464,6 +464,7 @@ icp start in-coming priority for expression
|
||||
dc i1'3' caroteqop
|
||||
dc i1'3' bareqop
|
||||
dc i1'200' poundpoundop
|
||||
dc i1'200' dotdotdotsy
|
||||
dc i1'200' eolsy
|
||||
dc i1'200' eofsy
|
||||
dc i1'200' typedef
|
||||
@ -639,6 +640,7 @@ isp start in stack priority for expression
|
||||
dc i1'2' caroteqop
|
||||
dc i1'2' bareqop
|
||||
dc i1'0' poundpoundop
|
||||
dc i1'0' dotdotdotsy
|
||||
dc i1'0' eolsy
|
||||
dc i1'0' eofsy
|
||||
dc i1'0' typedef
|
||||
|
Loading…
Reference in New Issue
Block a user