* extend scanning of $modeswitch to support not only + and -, but also ON and OFF like other switches

+ added tests

git-svn-id: trunk@39280 -
This commit is contained in:
svenbarth 2018-06-22 21:29:08 +00:00
parent f036e67d8f
commit ff407c56d9
7 changed files with 128 additions and 2 deletions

5
.gitattributes vendored
View File

@ -10882,6 +10882,8 @@ tests/tbf/tb0255a.pp svneol=native#text/pascal
tests/tbf/tb0255b.pp svneol=native#text/pascal
tests/tbf/tb0255c.pp svneol=native#text/pascal
tests/tbf/tb0256.pp svneol=native#text/pascal
tests/tbf/tb0257a.pp svneol=native#text/pascal
tests/tbf/tb0257b.pp svneol=native#text/pascal
tests/tbf/ub0115.pp svneol=native#text/plain
tests/tbf/ub0149.pp svneol=native#text/plain
tests/tbf/ub0158a.pp svneol=native#text/plain
@ -11531,6 +11533,9 @@ tests/tbs/tb0641.pp svneol=native#text/pascal
tests/tbs/tb0642.pp svneol=native#text/pascal
tests/tbs/tb0643.pp svneol=native#text/pascal
tests/tbs/tb0644.pp svneol=native#text/pascal
tests/tbs/tb0645a.pp svneol=native#text/pascal
tests/tbs/tb0645b.pp svneol=native#text/pascal
tests/tbs/tb0645c.pp svneol=native#text/pascal
tests/tbs/tb205.pp svneol=native#text/plain
tests/tbs/tb610.pp svneol=native#text/pascal
tests/tbs/tb613.pp svneol=native#text/plain

View File

@ -976,8 +976,10 @@ unit scandir;
current_scanner.skipspace;
current_scanner.readstring;
s:=pattern;
if c in ['+','-'] then
s:=s+current_scanner.readstate;
{ don't combine the assignments to s as the method call will be
done before "pattern" is assigned to s and the method changes
"pattern" }
s:=s+current_scanner.readoptionalstate('+');
if not SetCompileModeSwitch(s,false) then
Message1(scan_w_illegal_switch,s)
end;

25
tests/tbf/tb0257a.pp Normal file
View File

@ -0,0 +1,25 @@
{ %FAIL }
unit tb0257a;
{$mode delphi}
{$modeswitch advancedrecords-}
interface
type
TTest = record
procedure Test;
end;
implementation
{ TTest }
procedure TTest.Test;
begin
end;
end.

25
tests/tbf/tb0257b.pp Normal file
View File

@ -0,0 +1,25 @@
{ %FAIL }
unit tb0257b;
{$mode delphi}
{$modeswitch advancedrecords off}
interface
type
TTest = record
procedure Test;
end;
implementation
{ TTest }
procedure TTest.Test;
begin
end;
end.

23
tests/tbs/tb0645a.pp Normal file
View File

@ -0,0 +1,23 @@
unit tb0645a;
{$mode objfpc}
{$modeswitch advancedrecords}
interface
type
TTest = record
procedure Test;
end;
implementation
{ TTest }
procedure TTest.Test;
begin
end;
end.

23
tests/tbs/tb0645b.pp Normal file
View File

@ -0,0 +1,23 @@
unit tb0645b;
{$mode objfpc}
{$modeswitch advancedrecords+}
interface
type
TTest = record
procedure Test;
end;
implementation
{ TTest }
procedure TTest.Test;
begin
end;
end.

23
tests/tbs/tb0645c.pp Normal file
View File

@ -0,0 +1,23 @@
unit tb0645c;
{$mode objfpc}
{$modeswitch advancedrecords on}
interface
type
TTest = record
procedure Test;
end;
implementation
{ TTest }
procedure TTest.Test;
begin
end;
end.