Закончил превращение синтаксиса [] по умолчанию в массивы
This commit is contained in:
parent
45fdde24b4
commit
db9679d89f
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "10";
|
||||
public const string Build = "1";
|
||||
public const string Revision = "3581";
|
||||
public const string Revision = "3589";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%MINOR%=10
|
||||
%REVISION%=3581
|
||||
%REVISION%=3589
|
||||
%COREVERSION%=1
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
3.10.1.3581
|
||||
3.10.1.3589
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.10.1.3581'
|
||||
!define VERSION '3.10.1.3589'
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const
|
|||
SLICE_SIZE_AND_RIGHT_VALUE_SIZE_MUST_BE_EQUAL = 'Размеры среза и присваиваемого выражения должны быть равны!!Slice size and assigned expression size must be equal';
|
||||
OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT = 'Выход за границы типа множества!!Out of type range in set assignment';
|
||||
OUT_OF_TYPE_RANGE_IN_SET_OPERATION = 'Выход за границы типа множества!!Out of type range in set operation';
|
||||
|
||||
OUT_OF_TYPE_RANGE_IN_ARR_OPERATION = 'Выход за границы типа массива!!Out of type range in array operation';
|
||||
|
||||
//{{{doc: Начало секции расширений строк для срезов }}}
|
||||
|
||||
|
|
@ -967,7 +967,7 @@ begin
|
|||
end;
|
||||
|
||||
function operator+(a: set of byte; b: set of integer): set of integer; extensionmethod
|
||||
:= b * a;
|
||||
:= b + a;
|
||||
|
||||
function operator+(a: set of integer; b: set of int64): set of int64; extensionmethod;
|
||||
begin
|
||||
|
|
@ -976,7 +976,7 @@ begin
|
|||
end;
|
||||
|
||||
function operator+(a: set of int64; b: set of integer): set of int64; extensionmethod
|
||||
:= b * a;
|
||||
:= b + a;
|
||||
|
||||
// set + array
|
||||
function operator+(a: array of integer; b: set of byte): set of integer; extensionmethod;
|
||||
|
|
@ -986,7 +986,7 @@ begin
|
|||
end;
|
||||
|
||||
function operator+(a: set of byte; b: array of integer): set of integer; extensionmethod
|
||||
:= b * a;
|
||||
:= b + a;
|
||||
|
||||
function operator+(a: array of integer; b: set of int64): set of int64; extensionmethod;
|
||||
begin
|
||||
|
|
@ -995,7 +995,7 @@ begin
|
|||
end;
|
||||
|
||||
function operator+(a: set of int64; b: array of integer): set of int64; extensionmethod
|
||||
:= b * a;
|
||||
:= b + a;
|
||||
|
||||
function operator+(a: set of integer; b: array of integer): set of integer; extensionmethod;
|
||||
begin
|
||||
|
|
@ -1004,7 +1004,42 @@ begin
|
|||
end;
|
||||
|
||||
function operator+(a: array of integer; b: set of integer): set of integer; extensionmethod
|
||||
:= b * a;
|
||||
:= b + a;
|
||||
|
||||
|
||||
// operator+ для array of num + [1,2,3]
|
||||
function operator+(a: array of byte; b: array of integer): array of integer; extensionmethod
|
||||
:= a.ConvertAll(x -> integer(x)) + b;
|
||||
function operator+(a: array of integer; b: array of byte): array of integer; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of shortint; b: array of integer): array of integer; extensionmethod
|
||||
:= a.ConvertAll(x -> integer(x)) + b;
|
||||
function operator+(a: array of integer; b: array of shortint): array of integer; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of smallint; b: array of integer): array of integer; extensionmethod
|
||||
:= a.ConvertAll(x -> integer(x)) + b;
|
||||
function operator+(a: array of integer; b: array of smallint): array of integer; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of word; b: array of integer): array of integer; extensionmethod
|
||||
:= a.ConvertAll(x -> integer(x)) + b;
|
||||
function operator+(a: array of integer; b: array of word): array of integer; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of longword; b: array of integer): array of int64; extensionmethod
|
||||
:= a.ConvertAll(x -> int64(x)) + b.ConvertAll(x -> int64(x));
|
||||
function operator+(a: array of integer; b: array of longword): array of int64; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of int64; b: array of integer): array of int64; extensionmethod
|
||||
:= a + b.ConvertAll(x -> int64(x));
|
||||
function operator+(a: array of integer; b: array of int64): array of int64; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of uint64; b: array of integer): array of uint64; extensionmethod;
|
||||
begin
|
||||
if b.Any(x -> x < 0) then
|
||||
raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_ARR_OPERATION));
|
||||
Result := a + b.ConvertAll(x -> uint64(x));
|
||||
end;
|
||||
function operator+(a: array of integer; b: array of uint64): array of uint64; extensionmethod
|
||||
:= b + a;
|
||||
|
||||
|
||||
// operator- sets
|
||||
|
|
@ -1069,6 +1104,93 @@ begin
|
|||
Result.hs.ExceptWith(b);
|
||||
end;
|
||||
|
||||
{function operator in(x: byte; a: array of integer): boolean; extensionmethod
|
||||
:= a.Contains(integer(x));
|
||||
function operator in(x: word; a: array of integer): boolean; extensionmethod
|
||||
:= a.Contains(integer(x));
|
||||
function operator in(x: shortint; a: array of integer): boolean; extensionmethod
|
||||
:= a.Contains(integer(x));
|
||||
function operator in(x: smallint; a: array of integer): boolean; extensionmethod
|
||||
:= a.Contains(integer(x));
|
||||
function operator in(x: longword; a: array of integer): boolean; extensionmethod
|
||||
:= a.Select(x -> int64(x)).Contains(int64(x));
|
||||
function operator in(x: int64; a: array of integer): boolean; extensionmethod
|
||||
:= a.Select(x -> int64(x)).Contains(x);
|
||||
function operator in(x: uint64; a: array of integer): boolean; extensionmethod;
|
||||
begin
|
||||
if x > integer.MaxValue then
|
||||
Result := False
|
||||
else Result := a.Contains(integer(x));
|
||||
end;}
|
||||
|
||||
function operator in(x: int64; a: array of byte): boolean; extensionmethod
|
||||
:= (x >= byte.MinValue) and (x <= byte.MaxValue) and a.Contains(byte(x));
|
||||
function operator in(x: int64; a: array of shortint): boolean; extensionmethod
|
||||
:= (x >= shortint.MinValue) and (x <= shortint.MaxValue) and a.Contains(shortint(x));
|
||||
function operator in(x: int64; a: array of smallint): boolean; extensionmethod
|
||||
:= (x >= smallint.MinValue) and (x <= smallint.MaxValue) and a.Contains(smallint(x));
|
||||
function operator in(x: int64; a: array of word): boolean; extensionmethod
|
||||
:= (x >= word.MinValue) and (x <= word.MaxValue) and a.Contains(word(x));
|
||||
function operator in(x: int64; a: array of longword): boolean; extensionmethod
|
||||
:= (x >= longword.MinValue) and (x <= longword.MaxValue) and a.Contains(longword(x));
|
||||
function operator in(x: int64; a: array of integer): boolean; extensionmethod
|
||||
:= (x >= integer.MinValue) and (x <= integer.MaxValue) and a.Contains(integer(x));
|
||||
function operator in(x: int64; a: array of uint64): boolean; extensionmethod
|
||||
:= (x >= uint64.MinValue) and a.Contains(uint64(x));
|
||||
|
||||
function operator in(x: byte; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
function operator in(x: shortint; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
function operator in(x: smallint; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
function operator in(x: word; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
function operator in(x: longword; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
function operator in(x: integer; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
var __initialized: boolean;
|
||||
|
||||
|
|
|
|||
|
|
@ -540,6 +540,9 @@ type
|
|||
Result.hs.UnionWith(first); Result._hs.ExceptWith(second);
|
||||
end;
|
||||
static function operator=(first, second: NewSet<T>) := first.hs.SetEquals(second.hs);
|
||||
{static function operator=(first: NewSet<T>; second: array of T) := first.hs.SetEquals(second);
|
||||
static function operator=(first: array of T; second: NewSet<T>) := second = first;}
|
||||
|
||||
static function operator<>(first, second: NewSet<T>) := not (first = second);
|
||||
static function operator<(first, second: NewSet<T>) := first.hs.IsProperSubsetOf(second.hs);
|
||||
static function operator<=(first, second: NewSet<T>) := first.hs.IsSubsetOf(second.hs);
|
||||
|
|
@ -5015,6 +5018,7 @@ end;
|
|||
|
||||
///--
|
||||
function operator in<T>(x: T; a: array of T): boolean; extensionmethod := a.Contains(x);
|
||||
// operator in для конкретных num in [1,2,3] - в PABCExtensions
|
||||
|
||||
function operator*<T>(a: array of T; n: integer): array of T; extensionmethod;
|
||||
begin
|
||||
|
|
@ -15478,7 +15482,11 @@ end;
|
|||
|
||||
|
||||
|
||||
//function operator implicit<T>(ns: NewSetEmpty): NewSet<T>; extensionmethod; begin end;
|
||||
function operator implicit<T>(a: array of T): HashSet<T>; extensionmethod
|
||||
:= new HashSet<T>(a);
|
||||
|
||||
function operator implicit(a: array of integer): HashSet<integer>; extensionmethod
|
||||
:= new HashSet<integer>(a);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Внутренние вспомогательные функции
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
type TClass = class
|
||||
type TClass = class
|
||||
function Test1 : integer;
|
||||
begin
|
||||
Result := 1;
|
||||
|
|
@ -50,7 +50,7 @@ if Test3 then
|
|||
begin
|
||||
end;
|
||||
while not Test3 do;
|
||||
var set1 := [Test1,Test2];
|
||||
var set1: set of integer := [Test1,Test2];
|
||||
assert(Test1 in set1);
|
||||
var set2 := [Test1..Test2];
|
||||
assert(3 in set2);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
type TFunc = function(i: integer):integer;
|
||||
type TFunc = function(i: integer):integer;
|
||||
|
||||
function f1(i : integer) : integer;
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
procedure p<T>(s: set of T; f: T->T);
|
||||
procedure p<T>(s: set of T; f: T->T);
|
||||
begin
|
||||
foreach var x in s do
|
||||
begin
|
||||
|
|
@ -8,6 +8,6 @@ begin
|
|||
end;
|
||||
|
||||
begin
|
||||
var s := [1,2,3,7,2,4];
|
||||
var s: set of integer := [1,2,3,7,2,4];
|
||||
p(s,x->x);
|
||||
end.
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@ begin
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
assert(SetOf(1,4,6)*[1,6]=[1,6]);
|
||||
assert(SetOf(1)+[2] <= [1..3]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
@ -113,10 +113,10 @@ s2 := [1,4]; assert(s2 = [1,4]);
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
assert(SetOf(1,4,6)*[1,6]=[1,6]);
|
||||
assert(SetOf(1)+[2] <= [1..3]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
@ -162,10 +162,10 @@ begin
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
assert(SetOf(1,4,6)*[1,6]=[1,6]);
|
||||
assert(SetOf(1)+[2] <= [1..3]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
@ -249,10 +249,10 @@ begin
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
assert(SetOf(1,4,6)*[1,6]=[1,6]);
|
||||
assert(SetOf(1)+[2] <= [1..3]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
begin
|
||||
begin
|
||||
var s1 := ['a'];
|
||||
var s := ['a','b','c']-s1;
|
||||
var s := SetOf('a','b','c')-s1;
|
||||
assert('b' in s);
|
||||
end.
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
begin
|
||||
var tupl := (1,2,[3,4,5]);
|
||||
assert(tupl.Item1 = 1);
|
||||
assert(tupl.Item3 = [3,4,5]);
|
||||
assert(tupl.Item3 = SetOf(3,4,5));
|
||||
assert(4 in tupl.Item3);
|
||||
var s: set of integer := tupl.Item3;
|
||||
assert(4 in s);
|
||||
|
|
|
|||
|
|
@ -50,10 +50,11 @@ begin
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
var sss: set of integer := [1,4,6];
|
||||
assert(sss*[1,6]=[1,6]);
|
||||
assert(SetOf(1)+[2] <= [1..3]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
@ -115,10 +116,10 @@ s2 := [1,4]; assert(s2 = [1,4]);
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
assert(SetOf(1,4,6)*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
@ -164,10 +165,10 @@ begin
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
assert(SetOf(1,4,6)*[1,6]=[1,6]);
|
||||
assert(SetOf(1)+[2] <= [1..3]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
@ -252,10 +253,10 @@ begin
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
assert(SetOf(1,4,6)*[1,6]=[1,6]);
|
||||
assert(SetOf(1)+[2] <= [1..3]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
s : set of 1..3 = [1,2,3,4];
|
||||
s2 : set of char = {['a','b']*}['b'];
|
||||
|
||||
var s3 : set of 1..3 := [1,2]+[3,4];
|
||||
var s3 : set of 1..3 := SetOf(1,2)+[3,4];
|
||||
|
||||
begin
|
||||
assert(s=[1,2,3,4]);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
s2 : set of integer;
|
||||
|
||||
begin
|
||||
assert([b,sh,sm,w,i,lw,li,ui]=[1,2,3,4,5,6,7,8]);
|
||||
var s1_8: set of integer := [1,2,3,4,5,6,7,8];
|
||||
assert([b,sh,sm,w,i,lw,li,ui]=s1_8);
|
||||
Include(s1,integer.MaxValue);
|
||||
s1.Add(longword.MaxValue);
|
||||
//s1 += [longword.MaxValue];
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
type TArr = array[1..3] of integer;
|
||||
type TArr = array[1..3] of integer;
|
||||
TRec = record a : integer; b : real; end;
|
||||
TSet = set of byte;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
uses typedconst2u;
|
||||
uses typedconst2u;
|
||||
begin
|
||||
assert(a=[1..4]);
|
||||
assert(2 in a);
|
||||
|
|
@ -9,13 +9,13 @@ assert('b' in e);
|
|||
assert(e=['a','b','c']);
|
||||
assert(f=two);
|
||||
assert(one in g);
|
||||
assert(g=[one,three]);
|
||||
assert(g=SetOf(one,three));
|
||||
assert(h=one);
|
||||
assert(i=3);
|
||||
assert(j[3]=2.6);
|
||||
assert(k=two);
|
||||
assert(three in l);
|
||||
assert(l=[one,three]);
|
||||
assert(l=SetOf(one,three));
|
||||
assert(m.b[1]=3);
|
||||
assert(n[1,2]=2);
|
||||
end.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
unit u_class2;
|
||||
unit u_class2;
|
||||
type TClass = class
|
||||
function Test1 : integer;
|
||||
begin
|
||||
|
|
@ -51,7 +51,7 @@ if Test3 then
|
|||
begin
|
||||
end;
|
||||
while not Test3 do;
|
||||
var set1 := [Test1,Test2];
|
||||
var set1: set of integer := [Test1,Test2];
|
||||
assert(Test1 in set1);
|
||||
var set2 := [Test1..Test2];
|
||||
assert(3 in set2);
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@ begin
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
assert(SetOf(1,4,6)*[1,6]=[1,6]);
|
||||
assert(SetOf(1)+[2] <= [1..3]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
@ -114,10 +114,10 @@ s2 := [1,4]; assert(s2 = [1,4]);
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
assert(SetOf(1,4,6)*[1,6]=[1,6]);
|
||||
assert(SetOf(1)+[2] <= [1..3]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
@ -163,10 +163,10 @@ begin
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
assert(SetOf(1,4,6)*[1,6]=[1,6]);
|
||||
assert(SetOf(1)+[2] <= [1..3]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
@ -250,10 +250,10 @@ begin
|
|||
assert([2..4]=[2,3,4]);
|
||||
assert(['a','c'..'f']>['a']);
|
||||
assert([1..6]<>[2..4]);
|
||||
assert([2,3]+[7,8]=[2,3,7,8]);
|
||||
assert([1,4,6]*[1,6]=[1,6]);
|
||||
assert([1]+[2] <= [1..3]);
|
||||
assert([2,3,5]-[2,3] = [5]);
|
||||
assert(SetOf(2,3)+[7,8]=[2,3,7,8]);
|
||||
assert(SetOf(1,4,6)*[1,6]=[1,6]);
|
||||
assert(SetOf(1)+[2] <= [1..3]);
|
||||
assert(SetOf(2,3,5)-[2,3] = [5]);
|
||||
assert(5 in [4,5,8]);
|
||||
assert([1,2]+[] = [1,2]);
|
||||
assert([1,2]*[] = []);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ var
|
|||
s2 : set of integer;
|
||||
|
||||
begin
|
||||
assert([b,sh,sm,w,i,lw,li,ui]=[1,2,3,4,5,6,7,8]);
|
||||
assert([b,sh,sm,w,i,lw,li,ui]=SetOf(1,2,3,4,5,6,7,8));
|
||||
Include(s1,integer.MaxValue);
|
||||
s1.Add(longword.MaxValue);
|
||||
s1 += [int64.MaxValue,uint64.MaxValue];
|
||||
|
|
|
|||
|
|
@ -5232,6 +5232,19 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
public override void visit(SyntaxTree.pascal_set_constant _pascal_set_constant)
|
||||
{
|
||||
// Если хоть одно - diapason_expr, то это множество иначе литеральный массив
|
||||
if (_pascal_set_constant.values == null ||
|
||||
_pascal_set_constant.values.expressions.Any(ex => ex is SyntaxTree.diapason_expr)
|
||||
)
|
||||
{ // это множество
|
||||
}
|
||||
else
|
||||
{
|
||||
var exl = new expression_list(_pascal_set_constant.values.expressions, _pascal_set_constant.source_context);
|
||||
array_const_new ac = new array_const_new(exl,exl.source_context);
|
||||
visit(ac);
|
||||
return;
|
||||
}
|
||||
// надо разбить на 2 списка констант
|
||||
expressions_list consts = new expressions_list();
|
||||
expressions_list consts_diap = new expressions_list();
|
||||
|
|
@ -5374,10 +5387,15 @@ namespace PascalABCCompiler.TreeConverter
|
|||
public override void visit(SyntaxTree.array_const_new acn)
|
||||
{
|
||||
var lst = acn.elements.expressions.Select(ex => { var semex = convert_strong(ex); try_convert_typed_expression_to_function_call(ref semex); return semex; }).ToList();
|
||||
|
||||
|
||||
type_node_list types = new type_node_list();
|
||||
foreach (var tn in lst.Select(ex => ex.type))
|
||||
types.AddElement(tn);
|
||||
{
|
||||
if (tn.type_special_kind == type_special_kind.diap_type) // SSM 4/12/24 - стирание информации о типе диапазона
|
||||
types.AddElement(tn.base_type);
|
||||
else types.AddElement(tn);
|
||||
}
|
||||
|
||||
var el_type = convertion_data_and_alghoritms.select_base_type_for_arr_const_new(types, lst, true);
|
||||
var syntax_type = new SyntaxTree.semantic_type_node(el_type);
|
||||
//SyntaxTree.semantic_addr_value sav;
|
||||
|
|
@ -15098,6 +15116,8 @@ namespace PascalABCCompiler.TreeConverter
|
|||
AddError(get_location(_array_type.indexers), "ARRAY_RANK_CANNOT_BE_GREATER_32");
|
||||
type_node ret = null;
|
||||
type_node et = convert_strong(_array_type.elements_type);
|
||||
if (et.type_special_kind == type_special_kind.diap_type) // SSM 4/12/24
|
||||
et = et.base_type;
|
||||
//if (et == SystemLibrary.SystemLibrary.void_type)
|
||||
//AddError(new VoidNotValid(get_location(_array_type.elemets_types)));
|
||||
check_for_type_allowed(et,get_location(_array_type.elements_type));
|
||||
|
|
@ -15311,6 +15331,27 @@ namespace PascalABCCompiler.TreeConverter
|
|||
is_userdefined = !(cnf.function_node.namespace_node.namespace_name.Equals(StringConstants.pascalSystemUnitName) || cnf.function_node.namespace_node.namespace_name.Equals("PABCSystem_implementation______"));
|
||||
}
|
||||
|
||||
/*if (exp.type is ArrayConstType
|
||||
|| convertion_data_and_alghoritms.eq_type_nodes(exp.type, tn))
|
||||
{
|
||||
return convert_strong_to_constant_node(exp, tn, is_const_section && is_userdefined, is_const_section);
|
||||
}
|
||||
else
|
||||
{
|
||||
var conv = convertion_data_and_alghoritms.convert_type(exp, tn);
|
||||
return convert_strong_to_constant_node(conv, tn, is_const_section && is_userdefined, is_const_section);
|
||||
}*/
|
||||
|
||||
/*if (expr is pascal_set_constant)
|
||||
{
|
||||
var conv = convertion_data_and_alghoritms.convert_type(exp, tn);
|
||||
return convert_strong_to_constant_node(conv, tn, is_const_section && is_userdefined, is_const_section);
|
||||
}
|
||||
else
|
||||
{
|
||||
return convert_strong_to_constant_node(exp, tn, is_const_section && is_userdefined, is_const_section);
|
||||
}*/
|
||||
|
||||
return convert_strong_to_constant_node(exp, tn, is_const_section && is_userdefined, is_const_section);
|
||||
}
|
||||
|
||||
|
|
@ -15424,12 +15465,14 @@ namespace PascalABCCompiler.TreeConverter
|
|||
constant = new common_namespace_function_call_as_constant(expr as common_namespace_function_call, loc);
|
||||
return constant;
|
||||
}
|
||||
foreach (expression_node el in cnfc.parameters)
|
||||
convert_strong_to_constant_node(el, el.type, false, false, cnfc.location);
|
||||
if (cnfc.function_node.name != "op_Implicit")
|
||||
foreach (expression_node el in cnfc.parameters)
|
||||
convert_strong_to_constant_node(el, el.type, false, false, cnfc.location);
|
||||
//if (cnfc.function_node.namespace_node == context.converted_namespace)
|
||||
// AddError(loc, "CONSTANT_EXPRESSION_EXPECTED");
|
||||
// throw new ConstantExpressionExpected(loc);
|
||||
constant = new common_namespace_function_call_as_constant(expr as common_namespace_function_call, loc);
|
||||
return constant;
|
||||
}
|
||||
else if (expr is common_namespace_function_call_as_constant cnfcac
|
||||
&& cnfcac.type.name == "NewSetEmpty")
|
||||
|
|
@ -15444,6 +15487,11 @@ namespace PascalABCCompiler.TreeConverter
|
|||
constant = cnfcac1;
|
||||
return constant;
|
||||
}
|
||||
else if (expr is common_constructor_call)
|
||||
{
|
||||
constant = new common_constructor_call_as_constant(expr as common_constructor_call, null);
|
||||
return constant;
|
||||
}
|
||||
else if (expr is common_constructor_call_as_constant cccac)
|
||||
{
|
||||
//
|
||||
|
|
@ -15455,9 +15503,38 @@ namespace PascalABCCompiler.TreeConverter
|
|||
basic_function_call cnfc = expr as basic_function_call;
|
||||
//if (cnfc.function_node.namespace_node == context.converted_namespace)
|
||||
// throw new ConstantExpressionExpected(loc);
|
||||
foreach (expression_node el in cnfc.parameters)
|
||||
convert_strong_to_constant_node(el, el.type);
|
||||
constant = new basic_function_call_as_constant(expr as basic_function_call, loc);
|
||||
|
||||
// Как быть с new integer[5](2,3,4)? Там cnfc.parameters сщдержит 1 элемент, у которого в parameters первые три элемента - информационные
|
||||
if (cnfc.parameters[0] is common_namespace_function_call cnsfc &&
|
||||
cnsfc.function_node.SpecialFunctionKind == SpecialFunctionKind.NewArray)
|
||||
{
|
||||
foreach (expression_node el in cnsfc.parameters.Skip(3)) // это для 1 + 2 * 3
|
||||
convert_strong_to_constant_node(el, el.type);
|
||||
if (convertion_data_and_alghoritms.eq_type_nodes(expr.type, tn))
|
||||
{
|
||||
constant = new basic_function_call_as_constant(expr as basic_function_call, loc);
|
||||
return constant;
|
||||
}
|
||||
else
|
||||
{
|
||||
var conv = convertion_data_and_alghoritms.convert_type(expr, tn);
|
||||
constant = convert_strong_to_constant_node(conv, tn);
|
||||
return constant;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (expression_node el in cnfc.parameters) // это для 1 + 2 * 3 - этот код был
|
||||
convert_strong_to_constant_node(el, el.type);
|
||||
}
|
||||
|
||||
constant = new basic_function_call_as_constant(expr as basic_function_call, loc); // - этот код был
|
||||
return constant;
|
||||
}
|
||||
else if (expr is basic_function_call_as_constant bfcac)
|
||||
{
|
||||
constant = bfcac;
|
||||
return constant;
|
||||
}
|
||||
else if (expr is typed_expression)
|
||||
{
|
||||
|
|
@ -15625,6 +15702,11 @@ namespace PascalABCCompiler.TreeConverter
|
|||
constant = new common_static_method_call_as_constant(csmc, null);
|
||||
break;
|
||||
}
|
||||
if (csmc.function_node.name == "op_Implicit") // SSM 04/12/24 - это делается для преобразования array в set
|
||||
{
|
||||
constant = new common_static_method_call_as_constant(csmc, loc);
|
||||
return constant;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -15991,7 +16073,17 @@ namespace PascalABCCompiler.TreeConverter
|
|||
else
|
||||
throw new CompilerInternalError("Unexpected array type");
|
||||
for (int i = 0; i < constant.element_values.Count; i++)
|
||||
constant.element_values[i] = convert_strong_to_constant_node(constant.element_values[i], element_type);
|
||||
{
|
||||
if (constant.element_values[i].type is ArrayConstType
|
||||
|| convertion_data_and_alghoritms.eq_type_nodes(constant.element_values[i].type,element_type))
|
||||
constant.element_values[i] = convert_strong_to_constant_node(constant.element_values[i], element_type);
|
||||
else
|
||||
{
|
||||
var conv = convertion_data_and_alghoritms.convert_type(constant.element_values[i], element_type);
|
||||
constant.element_values[i] = convert_strong_to_constant_node(conv, element_type);
|
||||
}
|
||||
//convertion_data_and_alghoritms.check_convert_type(constant.element_values[i], element_type,constant.element_values[i].location);
|
||||
}
|
||||
constant.SetType(tn);
|
||||
return constant;
|
||||
}
|
||||
|
|
@ -18207,6 +18299,16 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
expression_node left = convert_strong(_bin_expr.left);
|
||||
expression_node right = convert_strong(_bin_expr.right);
|
||||
|
||||
// SSM 04/12/24 - массивы нельзя умножать и вычитать. Это запрещено т.к. в библиотеку добавлены arr * set и arr - set
|
||||
if (left.type != null && left.type.type_special_kind == type_special_kind.array_kind
|
||||
&& right.type != null && right.type.type_special_kind == type_special_kind.array_kind
|
||||
&& (_bin_expr.operation_type == Operators.Multiplication || _bin_expr.operation_type == Operators.Minus)
|
||||
)
|
||||
{
|
||||
AddError(get_location(_bin_expr), "OPERATOR_{0}_CAN_NOT_BE_APPLIED_TO_TYPES_{1}_AND_{2}", name_reflector.get_name(_bin_expr.operation_type), left.type, right.type);
|
||||
}
|
||||
|
||||
if (_bin_expr.operation_type == Operators.In)
|
||||
try_convert_typed_expression_to_function_call(ref left);
|
||||
expression_node res = find_operator(_bin_expr.operation_type, left, right, get_location(_bin_expr));
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const
|
|||
SLICE_SIZE_AND_RIGHT_VALUE_SIZE_MUST_BE_EQUAL = 'Размеры среза и присваиваемого выражения должны быть равны!!Slice size and assigned expression size must be equal';
|
||||
OUT_OF_TYPE_RANGE_IN_SET_ASSIGNMENT = 'Выход за границы типа множества!!Out of type range in set assignment';
|
||||
OUT_OF_TYPE_RANGE_IN_SET_OPERATION = 'Выход за границы типа множества!!Out of type range in set operation';
|
||||
|
||||
OUT_OF_TYPE_RANGE_IN_ARR_OPERATION = 'Выход за границы типа массива!!Out of type range in array operation';
|
||||
|
||||
//{{{doc: Начало секции расширений строк для срезов }}}
|
||||
|
||||
|
|
@ -967,7 +967,7 @@ begin
|
|||
end;
|
||||
|
||||
function operator+(a: set of byte; b: set of integer): set of integer; extensionmethod
|
||||
:= b * a;
|
||||
:= b + a;
|
||||
|
||||
function operator+(a: set of integer; b: set of int64): set of int64; extensionmethod;
|
||||
begin
|
||||
|
|
@ -976,7 +976,7 @@ begin
|
|||
end;
|
||||
|
||||
function operator+(a: set of int64; b: set of integer): set of int64; extensionmethod
|
||||
:= b * a;
|
||||
:= b + a;
|
||||
|
||||
// set + array
|
||||
function operator+(a: array of integer; b: set of byte): set of integer; extensionmethod;
|
||||
|
|
@ -986,7 +986,7 @@ begin
|
|||
end;
|
||||
|
||||
function operator+(a: set of byte; b: array of integer): set of integer; extensionmethod
|
||||
:= b * a;
|
||||
:= b + a;
|
||||
|
||||
function operator+(a: array of integer; b: set of int64): set of int64; extensionmethod;
|
||||
begin
|
||||
|
|
@ -995,7 +995,7 @@ begin
|
|||
end;
|
||||
|
||||
function operator+(a: set of int64; b: array of integer): set of int64; extensionmethod
|
||||
:= b * a;
|
||||
:= b + a;
|
||||
|
||||
function operator+(a: set of integer; b: array of integer): set of integer; extensionmethod;
|
||||
begin
|
||||
|
|
@ -1004,7 +1004,42 @@ begin
|
|||
end;
|
||||
|
||||
function operator+(a: array of integer; b: set of integer): set of integer; extensionmethod
|
||||
:= b * a;
|
||||
:= b + a;
|
||||
|
||||
|
||||
// operator+ для array of num + [1,2,3]
|
||||
function operator+(a: array of byte; b: array of integer): array of integer; extensionmethod
|
||||
:= a.ConvertAll(x -> integer(x)) + b;
|
||||
function operator+(a: array of integer; b: array of byte): array of integer; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of shortint; b: array of integer): array of integer; extensionmethod
|
||||
:= a.ConvertAll(x -> integer(x)) + b;
|
||||
function operator+(a: array of integer; b: array of shortint): array of integer; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of smallint; b: array of integer): array of integer; extensionmethod
|
||||
:= a.ConvertAll(x -> integer(x)) + b;
|
||||
function operator+(a: array of integer; b: array of smallint): array of integer; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of word; b: array of integer): array of integer; extensionmethod
|
||||
:= a.ConvertAll(x -> integer(x)) + b;
|
||||
function operator+(a: array of integer; b: array of word): array of integer; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of longword; b: array of integer): array of int64; extensionmethod
|
||||
:= a.ConvertAll(x -> int64(x)) + b.ConvertAll(x -> int64(x));
|
||||
function operator+(a: array of integer; b: array of longword): array of int64; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of int64; b: array of integer): array of int64; extensionmethod
|
||||
:= a + b.ConvertAll(x -> int64(x));
|
||||
function operator+(a: array of integer; b: array of int64): array of int64; extensionmethod
|
||||
:= b + a;
|
||||
function operator+(a: array of uint64; b: array of integer): array of uint64; extensionmethod;
|
||||
begin
|
||||
if b.Any(x -> x < 0) then
|
||||
raise new System.ArgumentException(GetTranslation(OUT_OF_TYPE_RANGE_IN_ARR_OPERATION));
|
||||
Result := a + b.ConvertAll(x -> uint64(x));
|
||||
end;
|
||||
function operator+(a: array of integer; b: array of uint64): array of uint64; extensionmethod
|
||||
:= b + a;
|
||||
|
||||
|
||||
// operator- sets
|
||||
|
|
@ -1069,6 +1104,93 @@ begin
|
|||
Result.hs.ExceptWith(b);
|
||||
end;
|
||||
|
||||
{function operator in(x: byte; a: array of integer): boolean; extensionmethod
|
||||
:= a.Contains(integer(x));
|
||||
function operator in(x: word; a: array of integer): boolean; extensionmethod
|
||||
:= a.Contains(integer(x));
|
||||
function operator in(x: shortint; a: array of integer): boolean; extensionmethod
|
||||
:= a.Contains(integer(x));
|
||||
function operator in(x: smallint; a: array of integer): boolean; extensionmethod
|
||||
:= a.Contains(integer(x));
|
||||
function operator in(x: longword; a: array of integer): boolean; extensionmethod
|
||||
:= a.Select(x -> int64(x)).Contains(int64(x));
|
||||
function operator in(x: int64; a: array of integer): boolean; extensionmethod
|
||||
:= a.Select(x -> int64(x)).Contains(x);
|
||||
function operator in(x: uint64; a: array of integer): boolean; extensionmethod;
|
||||
begin
|
||||
if x > integer.MaxValue then
|
||||
Result := False
|
||||
else Result := a.Contains(integer(x));
|
||||
end;}
|
||||
|
||||
function operator in(x: int64; a: array of byte): boolean; extensionmethod
|
||||
:= (x >= byte.MinValue) and (x <= byte.MaxValue) and a.Contains(byte(x));
|
||||
function operator in(x: int64; a: array of shortint): boolean; extensionmethod
|
||||
:= (x >= shortint.MinValue) and (x <= shortint.MaxValue) and a.Contains(shortint(x));
|
||||
function operator in(x: int64; a: array of smallint): boolean; extensionmethod
|
||||
:= (x >= smallint.MinValue) and (x <= smallint.MaxValue) and a.Contains(smallint(x));
|
||||
function operator in(x: int64; a: array of word): boolean; extensionmethod
|
||||
:= (x >= word.MinValue) and (x <= word.MaxValue) and a.Contains(word(x));
|
||||
function operator in(x: int64; a: array of longword): boolean; extensionmethod
|
||||
:= (x >= longword.MinValue) and (x <= longword.MaxValue) and a.Contains(longword(x));
|
||||
function operator in(x: int64; a: array of integer): boolean; extensionmethod
|
||||
:= (x >= integer.MinValue) and (x <= integer.MaxValue) and a.Contains(integer(x));
|
||||
function operator in(x: int64; a: array of uint64): boolean; extensionmethod
|
||||
:= (x >= uint64.MinValue) and a.Contains(uint64(x));
|
||||
|
||||
function operator in(x: byte; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: byte; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
function operator in(x: shortint; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: shortint; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
function operator in(x: smallint; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: smallint; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
function operator in(x: word; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: word; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
function operator in(x: longword; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: longword; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
function operator in(x: integer; a: array of byte): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of shortint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of smallint): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of word): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of longword): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of integer): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of int64): boolean; extensionmethod := int64(x) in a;
|
||||
function operator in(x: integer; a: array of uint64): boolean; extensionmethod := int64(x) in a;
|
||||
|
||||
var __initialized: boolean;
|
||||
|
||||
|
|
|
|||
|
|
@ -540,6 +540,9 @@ type
|
|||
Result.hs.UnionWith(first); Result._hs.ExceptWith(second);
|
||||
end;
|
||||
static function operator=(first, second: NewSet<T>) := first.hs.SetEquals(second.hs);
|
||||
{static function operator=(first: NewSet<T>; second: array of T) := first.hs.SetEquals(second);
|
||||
static function operator=(first: array of T; second: NewSet<T>) := second = first;}
|
||||
|
||||
static function operator<>(first, second: NewSet<T>) := not (first = second);
|
||||
static function operator<(first, second: NewSet<T>) := first.hs.IsProperSubsetOf(second.hs);
|
||||
static function operator<=(first, second: NewSet<T>) := first.hs.IsSubsetOf(second.hs);
|
||||
|
|
@ -5015,6 +5018,7 @@ end;
|
|||
|
||||
///--
|
||||
function operator in<T>(x: T; a: array of T): boolean; extensionmethod := a.Contains(x);
|
||||
// operator in для конкретных num in [1,2,3] - в PABCExtensions
|
||||
|
||||
function operator*<T>(a: array of T; n: integer): array of T; extensionmethod;
|
||||
begin
|
||||
|
|
@ -15478,7 +15482,11 @@ end;
|
|||
|
||||
|
||||
|
||||
//function operator implicit<T>(ns: NewSetEmpty): NewSet<T>; extensionmethod; begin end;
|
||||
function operator implicit<T>(a: array of T): HashSet<T>; extensionmethod
|
||||
:= new HashSet<T>(a);
|
||||
|
||||
function operator implicit(a: array of integer): HashSet<integer>; extensionmethod
|
||||
:= new HashSet<integer>(a);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Внутренние вспомогательные функции
|
||||
|
|
|
|||
Loading…
Reference in a new issue