This commit is contained in:
Mikhalkovich Stanislav 2020-10-05 17:02:42 +03:00
parent e959c17d07
commit f06367a056
8 changed files with 89 additions and 30 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "7";
public const string Build = "1";
public const string Revision = "2709";
public const string Revision = "2710";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%MINOR%=7
%REVISION%=2709
%COREVERSION%=1
%REVISION%=2710
%MINOR%=7
%MAJOR%=3

View file

@ -1 +1 @@
3.7.1.2709
3.7.1.2710

View file

@ -1 +1 @@
!define VERSION '3.7.1.2709'
!define VERSION '3.7.1.2710'

View file

@ -50,25 +50,41 @@ type
public
[PrintAttribute(0, -16)]
property Name: string read _name;
[PrintAttribute(' ', 1, -3)]
property Gender: ТипПола read getGender;
[PrintAttribute(' ', 2, 3, 'd')]
property Height: integer read _height;
[PrintAttribute(' ',3, 2, 'd')]
property Cls: integer read _cls;
[PrintAttribute(' ', 4, -5)]
property InSunSchool: boolean read _inSunSchool;
end;
{Ученик = auto class
private
_name: string;
_gender: ТипПола;
_height: integer;
_cls: integer;
_inSunSchool: boolean;
function getGender: ТипПола := _gender;
public
[PrintAttribute(0, -16)]
property Фамилия: string read _name;
[PrintAttribute(' ', 1, -3)]
property Gender: ТипПола read getGender;
[PrintAttribute(' ', 1, -3)]
property Пол: ТипПола read getGender;
[PrintAttribute(' ', 2, 3, 'd')]
property Height: integer read _height;
[PrintAttribute(' ', 2, 3, 'd')]
property Рост: integer read _height;
[PrintAttribute(' ',3, 2, 'd')]
property Cls: integer read _cls;
[PrintAttribute(' ',3, 2, 'd')]
property Класс: integer read _cls;
[PrintAttribute(' ', 4, -5)]
property InSunSchool: boolean read _inSunSchool;
[PrintAttribute(' ', 4, -5)]
property УчитсяВКШ: boolean read _inSunSchool;
end;}
Ученик = auto class
Фамилия: string;
Класс, Рост: integer;
Пол: ТипПола;
УчитсяВКШ: boolean;
end;
function GenderToТипПола(a: string): ТипПола := a = 'Муж' ? Муж : Жен;
@ -266,7 +282,18 @@ begin
.Select(w->new Country(w[0],w[1],w[2].ToInteger,w[3])).ToArray;
end;
function ЗаполнитьМассивУчеников: array of Pupil;
function ЗаполнитьМассивУчеников: array of Ученик;
begin
var fname := 'c:\Program files (x86)\PascalABC.NET\Files\Databases\Ученики.csv';
if fname = '' then
raise new System.ApplicationException('Не найден массив учеников Databases\Ученики.csv');
Result := ReadLines(fname)
.Select(s->s.ToWords(';'))
.Select(w->new Ученик(w[0],w[1].ToInteger,w[4].ToInteger,GenderToТипПола(w[2]),
InSunschoolToBoolean(w[3]))).ToArray;
end;
function GetPupils: array of Pupil;
begin
var fname := 'c:\Program files (x86)\PascalABC.NET\Files\Databases\Ученики.csv';
if fname = '' then
@ -277,8 +304,6 @@ begin
InSunschoolToBoolean(w[3]))).ToArray;
end;
function GetPupils: array of Pupil := ЗаполнитьМассивУчеников;
function GetFitness: array of Fitness;
begin
var fname := 'Fitness.tst';

7
TestSuite/match1.pas Normal file
View file

@ -0,0 +1,7 @@
begin
match new string('d',1) with
//Ошибка времени выполнения: Индекс находился вне границ массива.
['d']: Assert(1=1);
else Assert(1=2);
end;
end.

View file

@ -15955,10 +15955,12 @@ namespace PascalABCCompiler.TreeConverter
}
else
{
var lbvr = nspr.expression as local_block_variable_reference;
//String 1 based
if (parameters.expressions.Count == 1 &&
nspr.property.comprehensive_type == SystemLibrary.SystemLibrary.string_type &&
!SemanticRules.NullBasedStrings)
!SemanticRules.NullBasedStrings && (lbvr == null || !lbvr.var.name.StartsWith("<>match")))
{
nspr.fact_parametres.AddElement(
ConstructDecExpr(

View file

@ -50,25 +50,41 @@ type
public
[PrintAttribute(0, -16)]
property Name: string read _name;
[PrintAttribute(' ', 1, -3)]
property Gender: ТипПола read getGender;
[PrintAttribute(' ', 2, 3, 'd')]
property Height: integer read _height;
[PrintAttribute(' ',3, 2, 'd')]
property Cls: integer read _cls;
[PrintAttribute(' ', 4, -5)]
property InSunSchool: boolean read _inSunSchool;
end;
{Ученик = auto class
private
_name: string;
_gender: ТипПола;
_height: integer;
_cls: integer;
_inSunSchool: boolean;
function getGender: ТипПола := _gender;
public
[PrintAttribute(0, -16)]
property Фамилия: string read _name;
[PrintAttribute(' ', 1, -3)]
property Gender: ТипПола read getGender;
[PrintAttribute(' ', 1, -3)]
property Пол: ТипПола read getGender;
[PrintAttribute(' ', 2, 3, 'd')]
property Height: integer read _height;
[PrintAttribute(' ', 2, 3, 'd')]
property Рост: integer read _height;
[PrintAttribute(' ',3, 2, 'd')]
property Cls: integer read _cls;
[PrintAttribute(' ',3, 2, 'd')]
property Класс: integer read _cls;
[PrintAttribute(' ', 4, -5)]
property InSunSchool: boolean read _inSunSchool;
[PrintAttribute(' ', 4, -5)]
property УчитсяВКШ: boolean read _inSunSchool;
end;}
Ученик = auto class
Фамилия: string;
Класс, Рост: integer;
Пол: ТипПола;
УчитсяВКШ: boolean;
end;
function GenderToТипПола(a: string): ТипПола := a = 'Муж' ? Муж : Жен;
@ -266,7 +282,18 @@ begin
.Select(w->new Country(w[0],w[1],w[2].ToInteger,w[3])).ToArray;
end;
function ЗаполнитьМассивУчеников: array of Pupil;
function ЗаполнитьМассивУчеников: array of Ученик;
begin
var fname := 'c:\Program files (x86)\PascalABC.NET\Files\Databases\Ученики.csv';
if fname = '' then
raise new System.ApplicationException('Не найден массив учеников Databases\Ученики.csv');
Result := ReadLines(fname)
.Select(s->s.ToWords(';'))
.Select(w->new Ученик(w[0],w[1].ToInteger,w[4].ToInteger,GenderToТипПола(w[2]),
InSunschoolToBoolean(w[3]))).ToArray;
end;
function GetPupils: array of Pupil;
begin
var fname := 'c:\Program files (x86)\PascalABC.NET\Files\Databases\Ученики.csv';
if fname = '' then
@ -277,8 +304,6 @@ begin
InSunschoolToBoolean(w[3]))).ToArray;
end;
function GetPupils: array of Pupil := ЗаполнитьМассивУчеников;
function GetFitness: array of Fitness;
begin
var fname := 'Fitness.tst';