diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs index 918ffd533..a6b574a5d 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs @@ -2,7 +2,7 @@ // This CSharp output file generated by Gardens Point LEX // Version: 1.1.3.301 // Machine: DESKTOP-G8V08V4 -// DateTime: 15.07.2024 13:28:05 +// DateTime: 19.07.2024 11:28:35 // UserName: ????????? // GPLEX input file // GPLEX frame file diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y index eebd4936f..73eaf8ea0 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y @@ -986,7 +986,7 @@ const_factor const_set : tkSquareOpen elem_list tkSquareClose - { + { $$ = new pascal_set_constant($2 as expression_list, @$); } | tkVertParen elem_list tkVertParen diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs index b8b06825d..c6227f0ce 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs @@ -2,7 +2,7 @@ // GPPG version 1.3.6 // Machine: DESKTOP-G8V08V4 -// DateTime: 15.07.2024 13:28:05 +// DateTime: 19.07.2024 11:28:36 // UserName: ????????? // Input file @@ -3661,7 +3661,13 @@ public partial class GPPGParser: ShiftReduceParser tkSquareOpen, elem_list, tkSquareClose -{ +{ + // �?сли elem_list п�?с�? или соде�?жи�? диапазон, �?о э�?о множес�?во, ина�?е массив. С PascalABC.NET 3.10 + var is_set = false; + var el = ValueStack[ValueStack.Depth-2].stn as expression_list; + if (el.Count == 0) + is_set = true; + CurrentSemanticValue.ex = new pascal_set_constant(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan); } break; diff --git a/Parsers/PascalABCParserNewSaushkin/PABC.ymc b/Parsers/PascalABCParserNewSaushkin/PABC.ymc index 1313c78af..6a411cf33 100644 --- a/Parsers/PascalABCParserNewSaushkin/PABC.ymc +++ b/Parsers/PascalABCParserNewSaushkin/PABC.ymc @@ -384,5 +384,6 @@ script= + diff --git a/bin/Lib/PABCExtensions.pas b/bin/Lib/PABCExtensions.pas index ac66024ed..1d9e9d7e7 100644 --- a/bin/Lib/PABCExtensions.pas +++ b/bin/Lib/PABCExtensions.pas @@ -409,6 +409,36 @@ begin Result += x; end;} +/// Функция создания множества set по указанным значениям +function SetOf(params a: array of T): set of T; +begin + Result := TypedSet.InitBy(a); +end; + +///-- +function operator implicit(a: array of integer): set of integer; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of real): set of real; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of string): set of string; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of char): set of char; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of shortint): set of shortint; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of int64): set of int64; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of byte): set of byte; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of word): set of word; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of longword): set of longword; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of BigInteger): set of BigInteger; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of decimal): set of decimal; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of single): set of single; extensionmethod := TypedSet.InitBy(a); //------------------------------------------------------------------------------ // Операции для procedure diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index ae182ca92..ced27eaae 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -519,9 +519,7 @@ type function ToString: string; override; class function operator implicit(s: TypedSet): HashSet; class function operator implicit(s: HashSet): TypedSet; - class function operator implicit(s: array of T): TypedSet; class function InitBy(s: sequence of T): TypedSet; - //class function operator implicit(a: array of T): TypedSet; function Count: integer := ht.Count; procedure Print(delim: string := ' '); procedure Println(delim: string := ' '); @@ -3537,7 +3535,7 @@ begin end; ///-- -class function TypedSet.operator implicit(s: array of T): TypedSet; +{class function TypedSet.operator implicit(s: array of T): TypedSet; begin var ts := new TypedSet(); foreach key: T in s do @@ -3545,17 +3543,6 @@ begin ts.ht[key] := key; end; Result := ts; -end; - -///-- -{class function TypedSet.operator implicit(a: array of T): TypedSet; -begin - var ts := new TypedSet(); - foreach key: T in a do - begin - ts.ht[key] := key; - end; - Result := ts; end;} ///--