* also accept {$elsif} after {$if(n)def} (mantis #34858)

git-svn-id: trunk@41724 -
This commit is contained in:
Jonas Maebe 2019-03-17 15:20:22 +00:00
parent 74fed2a4cd
commit bde560dac2
3 changed files with 18 additions and 2 deletions

1
.gitattributes vendored
View File

@ -16549,6 +16549,7 @@ tests/webtbs/tw3478.pp svneol=native#text/plain
tests/webtbs/tw3479.pp svneol=native#text/plain
tests/webtbs/tw34818.pp svneol=native#text/pascal
tests/webtbs/tw34848.pp svneol=native#text/pascal
tests/webtbs/tw34858.pp svneol=native#text/plain
tests/webtbs/tw3489.pp svneol=native#text/plain
tests/webtbs/tw34893.pp -text svneol=native#text/pascal
tests/webtbs/tw3490.pp svneol=native#text/plain

View File

@ -3833,14 +3833,14 @@ type
valuedescr: String;
begin
if assigned(preprocstack) and
(preprocstack.typ in [pp_if,pp_elseif]) then
(preprocstack.typ in [pp_if,pp_ifdef,pp_ifndef,pp_elseif]) then
begin
{ when the branch is accepted we use pp_elseif so we know that
all the next branches need to be rejected. when this branch is still
not accepted then leave it at pp_if }
if (preprocstack.typ=pp_elseif) then
preprocstack.accept:=false
else if (preprocstack.typ=pp_if) and preprocstack.accept then
else if (preprocstack.typ in [pp_if,pp_ifdef,pp_ifndef]) and preprocstack.accept then
begin
preprocstack.accept:=false;
preprocstack.typ:=pp_elseif;

15
tests/webtbs/tw34858.pp Normal file
View File

@ -0,0 +1,15 @@
{ %norun }
const a = 6;
{$IFDEF ENDIAN_LITTLE}
const b = 7;
{$ELSEIF a > 5}
const b = 7;
{$ELSE}
{$ERROR Unknown endian}
{$IFEND}
begin
if b<>7 then
halt(1);
end.