Пока закомментировал превращение множеств в массивы

This commit is contained in:
Mikhalkovich Stanislav 2024-07-19 13:01:43 +03:00
parent 84205f86bf
commit a8b7dc8be7
10 changed files with 81 additions and 31 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "9";
public const string Build = "0";
public const string Revision = "3514";
public const string Revision = "3516";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%COREVERSION%=0
%REVISION%=3514
%REVISION%=3516
%MINOR%=9
%MAJOR%=3

View file

@ -2,7 +2,7 @@
// This CSharp output file generated by Gardens Point LEX
// Version: 1.1.3.301
// Machine: DESKTOP-G8V08V4
// DateTime: 19.07.2024 11:28:35
// DateTime: 19.07.2024 12:42:46
// UserName: ?????????
// GPLEX input file <ABCPascal.lex>
// GPLEX frame file <embedded resource>

View file

@ -4,6 +4,7 @@
%{
// Эти объявления добавляются в класс GPPGParser, представляющий собой парсер, генерируемый системой gppg
public syntax_tree_node root; // Корневой узел синтаксического дерева
public int maxErrors = 10;
@ -987,7 +988,16 @@ const_factor
const_set
: tkSquareOpen elem_list tkSquareClose
{
$$ = new pascal_set_constant($2 as expression_list, @$);
// Если elem_list пуст или содержит диапазон, то это множество, иначе массив. С PascalABC.NET 3.10
/*var is_set = false;
var el = $2 as expression_list;
if (el == null || el.Count == 0)
is_set = true;
else if (el.expressions.Count(x => x is diapason_expr_new) > 0)
is_set = true;
if (is_set)*/
$$ = new pascal_set_constant($2 as expression_list, @$);
//else $$ = new array_const_new($2 as expression_list, @$);
}
| tkVertParen elem_list tkVertParen
{
@ -4164,7 +4174,16 @@ factor
{ $$ = $1; }
| tkSquareOpen elem_list tkSquareClose
{
$$ = new pascal_set_constant($2 as expression_list, @$);
// Если elem_list пуст или содержит диапазон, то это множество, иначе массив. С PascalABC.NET 3.10
/*var is_set = false;
var el = $2 as expression_list;
if (el == null || el.Count == 0)
is_set = true;
else if (el.expressions.Count(x => x is diapason_expr_new) > 0)
is_set = true;
if (is_set)*/
$$ = new pascal_set_constant($2 as expression_list, @$);
//else $$ = new array_const_new($2 as expression_list, @$);
}
| tkNot factor
{

View file

@ -2,9 +2,9 @@
// GPPG version 1.3.6
// Machine: DESKTOP-G8V08V4
// DateTime: 19.07.2024 11:28:36
// DateTime: 19.07.2024 12:42:47
// UserName: ?????????
// Input file <D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y>
// Input file <ABCPascal.y>
// options: no-lines gplex
@ -58,8 +58,9 @@ public abstract class ScanBase : AbstractScanner<PascalABCCompiler.ParserTools.U
public partial class GPPGParser: ShiftReduceParser<PascalABCCompiler.ParserTools.Union, LexLocation>
{
// Verbatim content from D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y
// Verbatim content from ABCPascal.y
// Э<>?и об<D0BE>?явления добавля<D0BB>?<3F>?ся в класс GPPGParser, п<>?едс<D0B4>?авля<D0BB>?<3F>?ий собой па<D0BF>?се<D181>?, гене<D0BD>?и<>?<3F>?ем<D0B5>?й сис<D0B8>?емой gppg
public syntax_tree_node root; // <20>?о<>?невой <20>?зел син<D0B8>?акси<D181>?еского де<D0B4>?ева
public int maxErrors = 10;
@ -67,7 +68,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCCompiler.ParserTools
public ParserLambdaHelper lambdaHelper = new ParserLambdaHelper();
public GPPGParser(AbstractScanner<PascalABCCompiler.ParserTools.Union, LexLocation> scanner) : base(scanner) { }
// End verbatim content from D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y
// End verbatim content from ABCPascal.y
#pragma warning disable 649
private static Dictionary<int, string> aliasses;
@ -3663,12 +3664,15 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCCompiler.ParserTools
case 164: // const_set -> tkSquareOpen, elem_list, tkSquareClose
{
// <20>?сли elem_list п<>?с<>? или соде<D0B4>?жи<D0B6>? диапазон, <20>?о э<>?о множес<D0B5>?во, ина<D0BD>?е массив. С PascalABC.NET 3.10
var is_set = false;
var el = ValueStack[ValueStack.Depth-2].stn as expression_list;
if (el.Count == 0)
/*var is_set = false;
var el = $2 as expression_list;
if (el == null || el.Count == 0)
is_set = true;
CurrentSemanticValue.ex = new pascal_set_constant(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan);
else if (el.expressions.Count(x => x is diapason_expr_new) > 0)
is_set = true;
if (is_set)*/
CurrentSemanticValue.ex = new pascal_set_constant(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan);
//else $$ = new array_const_new($2 as expression_list, @$);
}
break;
case 165: // const_set -> tkVertParen, elem_list, tkVertParen
@ -6682,7 +6686,16 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCCompiler.ParserTools
break;
case 765: // factor -> tkSquareOpen, elem_list, tkSquareClose
{
CurrentSemanticValue.ex = new pascal_set_constant(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan);
// <20>?сли elem_list п<>?с<>? или соде<D0B4>?жи<D0B6>? диапазон, <20>?о э<>?о множес<D0B5>?во, ина<D0BD>?е массив. С PascalABC.NET 3.10
/*var is_set = false;
var el = $2 as expression_list;
if (el == null || el.Count == 0)
is_set = true;
else if (el.expressions.Count(x => x is diapason_expr_new) > 0)
is_set = true;
if (is_set)*/
CurrentSemanticValue.ex = new pascal_set_constant(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan);
//else $$ = new array_const_new($2 as expression_list, @$);
}
break;
case 766: // factor -> tkNot, factor

View file

@ -385,5 +385,6 @@ script=

View file

@ -1 +1 @@
3.9.0.3514
3.9.0.3516

View file

@ -1 +1 @@
!define VERSION '3.9.0.3514'
!define VERSION '3.9.0.3516'

View file

@ -409,6 +409,36 @@ begin
Result += x;
end;}
/// Функция создания множества set по указанным значениям
function SetOf<T>(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

View file

@ -519,9 +519,7 @@ type
function ToString: string; override;
class function operator implicit<T>(s: TypedSet): HashSet<T>;
class function operator implicit<T>(s: HashSet<T>): TypedSet;
class function operator implicit<T>(s: array of T): TypedSet;
class function InitBy<T>(s: sequence of T): TypedSet;
//class function operator implicit<T>(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<T>(s: array of T): TypedSet;
{class function TypedSet.operator implicit<T>(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<T>(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;}
///--