a?[2:10:2]
This commit is contained in:
parent
813e061003
commit
32cc3ed88f
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "2";
|
||||
public const string Build = "0";
|
||||
public const string Revision = "1371";
|
||||
public const string Revision = "1372";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%COREVERSION%=0
|
||||
%REVISION%=1371
|
||||
%MINOR%=2
|
||||
%REVISION%=1372
|
||||
%COREVERSION%=0
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
|
|
@ -9210,7 +9210,8 @@ namespace PascalABCCompiler.NETGenerator
|
|||
}
|
||||
else
|
||||
{
|
||||
mi = helper.GetMethod(ifc.function).mi;
|
||||
var meth = helper.GetMethod(ifc.function);
|
||||
mi = meth.mi;
|
||||
}
|
||||
}
|
||||
PushObjectCommand(ifc);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
//
|
||||
// This CSharp output file generated by Gardens Point LEX
|
||||
// Version: 1.1.3.301
|
||||
// Machine: IVAN-PC
|
||||
// DateTime: 18.12.2016 12:52:06
|
||||
// UserName: Ivan
|
||||
// Machine: DESKTOP-8EAQPI9
|
||||
// DateTime: 09.01.2017 15:07:29
|
||||
// UserName: ?????????
|
||||
// GPLEX input file <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
//
|
||||
|
|
@ -124,8 +124,8 @@ namespace GPPGParserScanner
|
|||
|
||||
enum Result {accept, noMatch, contextFound};
|
||||
|
||||
const int maxAccept = 62;
|
||||
const int initial = 63;
|
||||
const int maxAccept = 63;
|
||||
const int initial = 64;
|
||||
const int eofNum = 0;
|
||||
const int goStart = -1;
|
||||
const int INITIAL = 0;
|
||||
|
|
@ -177,7 +177,7 @@ public PT parsertools;
|
|||
}
|
||||
};
|
||||
|
||||
static int[] startState = new int[] {63, 97, 98, 99, 99, 100,
|
||||
static int[] startState = new int[] {64, 98, 99, 100, 100, 101,
|
||||
0};
|
||||
|
||||
#region TwoLevelCharacterMap
|
||||
|
|
@ -1177,52 +1177,52 @@ public PT parsertools;
|
|||
return MapC(code);
|
||||
}
|
||||
|
||||
static Table[] NxS = new Table[102] {
|
||||
static Table[] NxS = new Table[103] {
|
||||
/* NxS[ 0] */ new Table(0, 0, 0, null),
|
||||
/* NxS[ 1] */ new Table(1, 19, -1, new sbyte[] {51, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52}),
|
||||
/* NxS[ 1] */ new Table(1, 19, -1, new sbyte[] {52, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53}),
|
||||
/* NxS[ 2] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 3] */ new Table(4, 1, -1, new sbyte[] {96}),
|
||||
/* NxS[ 4] */ new Table(26, 19, -1, new sbyte[] {49, 49, 49, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, 49, -1, -1, -1, -1, 49, 49, 49}),
|
||||
/* NxS[ 5] */ new Table(8, 1, -1, new sbyte[] {48}),
|
||||
/* NxS[ 6] */ new Table(19, 1, -1, new sbyte[] {47}),
|
||||
/* NxS[ 3] */ new Table(4, 1, -1, new sbyte[] {97}),
|
||||
/* NxS[ 4] */ new Table(26, 19, -1, new sbyte[] {50, 50, 50, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, 50, -1, -1, -1, -1, 50, 50, 50}),
|
||||
/* NxS[ 5] */ new Table(8, 1, -1, new sbyte[] {49}),
|
||||
/* NxS[ 6] */ new Table(19, 1, -1, new sbyte[] {48}),
|
||||
/* NxS[ 7] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 8] */ new Table(28, 17, -1, new sbyte[] {25, 25, 25, 25, 25, 25,
|
||||
25, 25, 25, 25, 25, 25, -1, 25, -1, 25, 25}),
|
||||
/* NxS[ 9] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 10] */ new Table(19, 1, -1, new sbyte[] {46}),
|
||||
/* NxS[ 11] */ new Table(13, 1, -1, new sbyte[] {45}),
|
||||
/* NxS[ 10] */ new Table(19, 1, -1, new sbyte[] {47}),
|
||||
/* NxS[ 11] */ new Table(13, 1, -1, new sbyte[] {46}),
|
||||
/* NxS[ 12] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 13] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 14] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 15] */ new Table(13, 1, -1, new sbyte[] {44}),
|
||||
/* NxS[ 15] */ new Table(13, 3, -1, new sbyte[] {44, -1, 45}),
|
||||
/* NxS[ 16] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 17] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 18] */ new Table(19, 1, -1, new sbyte[] {43}),
|
||||
/* NxS[ 19] */ new Table(19, 4, -1, new sbyte[] {41, -1, -1, 42}),
|
||||
/* NxS[ 20] */ new Table(19, 1, -1, new sbyte[] {40}),
|
||||
/* NxS[ 21] */ new Table(19, 5, -1, new sbyte[] {35, -1, -1, 36, 69}),
|
||||
/* NxS[ 21] */ new Table(19, 5, -1, new sbyte[] {35, -1, -1, 36, 70}),
|
||||
/* NxS[ 22] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 23] */ new Table(26, 1, -1, new sbyte[] {68}),
|
||||
/* NxS[ 24] */ new Table(13, 32, -1, new sbyte[] {65, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, 24, 24, 66, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, 24, -1, 66}),
|
||||
/* NxS[ 23] */ new Table(26, 1, -1, new sbyte[] {69}),
|
||||
/* NxS[ 24] */ new Table(13, 32, -1, new sbyte[] {66, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, 24, 24, 67, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, 24, -1, 67}),
|
||||
/* NxS[ 25] */ new Table(26, 19, -1, new sbyte[] {25, 25, 25, 25, 25, 25,
|
||||
25, 25, 25, 25, 25, 25, 25, 25, -1, 25, 25, 25, 25}),
|
||||
/* NxS[ 26] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 27] */ new Table(45, 4, 64, new sbyte[] {31, 64, 64, -1}),
|
||||
/* NxS[ 27] */ new Table(45, 4, 65, new sbyte[] {31, 65, 65, -1}),
|
||||
/* NxS[ 28] */ new Table(26, 19, -1, new sbyte[] {29, 29, 30, 30, 30, 30,
|
||||
30, 30, 30, 30, 30, 30, 30, 30, -1, 30, 29, 30, 30}),
|
||||
/* NxS[ 29] */ new Table(26, 17, -1, new sbyte[] {29, 29, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29}),
|
||||
/* NxS[ 30] */ new Table(26, 19, -1, new sbyte[] {30, 30, 30, 30, 30, 30,
|
||||
30, 30, 30, 30, 30, 30, 30, 30, -1, 30, 30, 30, 30}),
|
||||
/* NxS[ 31] */ new Table(45, 1, -1, new sbyte[] {64}),
|
||||
/* NxS[ 31] */ new Table(45, 1, -1, new sbyte[] {65}),
|
||||
/* NxS[ 32] */ new Table(26, 17, -1, new sbyte[] {32, 32, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32}),
|
||||
/* NxS[ 33] */ new Table(26, 19, -1, new sbyte[] {33, 33, 66, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, 66}),
|
||||
/* NxS[ 33] */ new Table(26, 19, -1, new sbyte[] {33, 33, 67, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, 67}),
|
||||
/* NxS[ 34] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 35] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 36] */ new Table(0, 0, -1, null),
|
||||
|
|
@ -1238,70 +1238,71 @@ public PT parsertools;
|
|||
/* NxS[ 46] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 47] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 48] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 49] */ new Table(26, 19, -1, new sbyte[] {49, 49, 49, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, 49, -1, -1, -1, -1, 49, 49, 49}),
|
||||
/* NxS[ 50] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 51] */ new Table(0, 7, 51, new sbyte[] {-1, 51, 51, 51, 51, 51,
|
||||
/* NxS[ 49] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 50] */ new Table(26, 19, -1, new sbyte[] {50, 50, 50, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, 50, -1, -1, -1, -1, 50, 50, 50}),
|
||||
/* NxS[ 51] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 52] */ new Table(0, 7, 52, new sbyte[] {-1, 52, 52, 52, 52, 52,
|
||||
-1}),
|
||||
/* NxS[ 52] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 53] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 54] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 55] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 56] */ new Table(9, 1, -1, new sbyte[] {57}),
|
||||
/* NxS[ 57] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 56] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 57] */ new Table(9, 1, -1, new sbyte[] {58}),
|
||||
/* NxS[ 58] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 59] */ new Table(1, 1, -1, new sbyte[] {62}),
|
||||
/* NxS[ 60] */ new Table(4, 1, -1, new sbyte[] {101}),
|
||||
/* NxS[ 61] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 62] */ new Table(0, 7, 62, new sbyte[] {-1, 62, 62, 62, 62, 62,
|
||||
/* NxS[ 59] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 60] */ new Table(1, 1, -1, new sbyte[] {63}),
|
||||
/* NxS[ 61] */ new Table(4, 1, -1, new sbyte[] {102}),
|
||||
/* NxS[ 62] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 63] */ new Table(0, 7, 63, new sbyte[] {-1, 63, 63, 63, 63, 63,
|
||||
-1}),
|
||||
/* NxS[ 63] */ new Table(40, 36, 25, new sbyte[] {26, 25, 24, 25, 25, 27,
|
||||
/* NxS[ 64] */ new Table(40, 36, 25, new sbyte[] {26, 25, 24, 25, 25, 27,
|
||||
28, 2, -1, 1, 2, 3, 4, -1, -1, 5, 6, 7, 8, 9, 10, 11,
|
||||
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 24}),
|
||||
/* NxS[ 64] */ new Table(45, 4, 64, new sbyte[] {31, 64, 64, -1}),
|
||||
/* NxS[ 65] */ new Table(26, 17, -1, new sbyte[] {33, 33, -1, -1, -1, -1,
|
||||
/* NxS[ 65] */ new Table(45, 4, 65, new sbyte[] {31, 65, 65, -1}),
|
||||
/* NxS[ 66] */ new Table(26, 17, -1, new sbyte[] {33, 33, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33}),
|
||||
/* NxS[ 66] */ new Table(20, 23, -1, new sbyte[] {67, 67, -1, -1, -1, -1,
|
||||
/* NxS[ 67] */ new Table(20, 23, -1, new sbyte[] {68, 68, -1, -1, -1, -1,
|
||||
32, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
32}),
|
||||
/* NxS[ 67] */ new Table(26, 17, -1, new sbyte[] {32, 32, -1, -1, -1, -1,
|
||||
/* NxS[ 68] */ new Table(26, 17, -1, new sbyte[] {32, 32, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32}),
|
||||
/* NxS[ 68] */ new Table(27, 1, -1, new sbyte[] {34}),
|
||||
/* NxS[ 69] */ new Table(28, 9, -1, new sbyte[] {70, -1, -1, -1, 71, -1,
|
||||
-1, -1, 72}),
|
||||
/* NxS[ 70] */ new Table(29, 1, -1, new sbyte[] {86}),
|
||||
/* NxS[ 71] */ new Table(36, 1, -1, new sbyte[] {77}),
|
||||
/* NxS[ 72] */ new Table(39, 1, -1, new sbyte[] {73}),
|
||||
/* NxS[ 73] */ new Table(30, 1, -1, new sbyte[] {74}),
|
||||
/* NxS[ 74] */ new Table(28, 1, -1, new sbyte[] {75}),
|
||||
/* NxS[ 75] */ new Table(22, 1, -1, new sbyte[] {76}),
|
||||
/* NxS[ 76] */ new Table(22, 1, -1, new sbyte[] {37}),
|
||||
/* NxS[ 77] */ new Table(37, 1, -1, new sbyte[] {78}),
|
||||
/* NxS[ 78] */ new Table(36, 1, -1, new sbyte[] {79}),
|
||||
/* NxS[ 79] */ new Table(28, 1, -1, new sbyte[] {80}),
|
||||
/* NxS[ 80] */ new Table(38, 1, -1, new sbyte[] {81}),
|
||||
/* NxS[ 81] */ new Table(28, 1, -1, new sbyte[] {82}),
|
||||
/* NxS[ 82] */ new Table(35, 1, -1, new sbyte[] {83}),
|
||||
/* NxS[ 83] */ new Table(36, 1, -1, new sbyte[] {84}),
|
||||
/* NxS[ 84] */ new Table(22, 1, -1, new sbyte[] {85}),
|
||||
/* NxS[ 85] */ new Table(22, 1, -1, new sbyte[] {38}),
|
||||
/* NxS[ 86] */ new Table(30, 1, -1, new sbyte[] {87}),
|
||||
/* NxS[ 87] */ new Table(31, 1, -1, new sbyte[] {88}),
|
||||
/* NxS[ 88] */ new Table(28, 1, -1, new sbyte[] {89}),
|
||||
/* NxS[ 89] */ new Table(32, 1, -1, new sbyte[] {90}),
|
||||
/* NxS[ 69] */ new Table(27, 1, -1, new sbyte[] {34}),
|
||||
/* NxS[ 70] */ new Table(28, 9, -1, new sbyte[] {71, -1, -1, -1, 72, -1,
|
||||
-1, -1, 73}),
|
||||
/* NxS[ 71] */ new Table(29, 1, -1, new sbyte[] {87}),
|
||||
/* NxS[ 72] */ new Table(36, 1, -1, new sbyte[] {78}),
|
||||
/* NxS[ 73] */ new Table(39, 1, -1, new sbyte[] {74}),
|
||||
/* NxS[ 74] */ new Table(30, 1, -1, new sbyte[] {75}),
|
||||
/* NxS[ 75] */ new Table(28, 1, -1, new sbyte[] {76}),
|
||||
/* NxS[ 76] */ new Table(22, 1, -1, new sbyte[] {77}),
|
||||
/* NxS[ 77] */ new Table(22, 1, -1, new sbyte[] {37}),
|
||||
/* NxS[ 78] */ new Table(37, 1, -1, new sbyte[] {79}),
|
||||
/* NxS[ 79] */ new Table(36, 1, -1, new sbyte[] {80}),
|
||||
/* NxS[ 80] */ new Table(28, 1, -1, new sbyte[] {81}),
|
||||
/* NxS[ 81] */ new Table(38, 1, -1, new sbyte[] {82}),
|
||||
/* NxS[ 82] */ new Table(28, 1, -1, new sbyte[] {83}),
|
||||
/* NxS[ 83] */ new Table(35, 1, -1, new sbyte[] {84}),
|
||||
/* NxS[ 84] */ new Table(36, 1, -1, new sbyte[] {85}),
|
||||
/* NxS[ 85] */ new Table(22, 1, -1, new sbyte[] {86}),
|
||||
/* NxS[ 86] */ new Table(22, 1, -1, new sbyte[] {38}),
|
||||
/* NxS[ 87] */ new Table(30, 1, -1, new sbyte[] {88}),
|
||||
/* NxS[ 88] */ new Table(31, 1, -1, new sbyte[] {89}),
|
||||
/* NxS[ 89] */ new Table(28, 1, -1, new sbyte[] {90}),
|
||||
/* NxS[ 90] */ new Table(32, 1, -1, new sbyte[] {91}),
|
||||
/* NxS[ 91] */ new Table(33, 1, -1, new sbyte[] {92}),
|
||||
/* NxS[ 92] */ new Table(34, 1, -1, new sbyte[] {93}),
|
||||
/* NxS[ 93] */ new Table(35, 1, -1, new sbyte[] {94}),
|
||||
/* NxS[ 94] */ new Table(22, 1, -1, new sbyte[] {95}),
|
||||
/* NxS[ 95] */ new Table(22, 1, -1, new sbyte[] {39}),
|
||||
/* NxS[ 96] */ new Table(0, 7, 96, new sbyte[] {-1, 96, 50, 96, 96, 96,
|
||||
/* NxS[ 91] */ new Table(32, 1, -1, new sbyte[] {92}),
|
||||
/* NxS[ 92] */ new Table(33, 1, -1, new sbyte[] {93}),
|
||||
/* NxS[ 93] */ new Table(34, 1, -1, new sbyte[] {94}),
|
||||
/* NxS[ 94] */ new Table(35, 1, -1, new sbyte[] {95}),
|
||||
/* NxS[ 95] */ new Table(22, 1, -1, new sbyte[] {96}),
|
||||
/* NxS[ 96] */ new Table(22, 1, -1, new sbyte[] {39}),
|
||||
/* NxS[ 97] */ new Table(0, 7, 97, new sbyte[] {-1, 97, 51, 97, 97, 97,
|
||||
-1}),
|
||||
/* NxS[ 97] */ new Table(2, 1, 53, new sbyte[] {54}),
|
||||
/* NxS[ 98] */ new Table(8, 1, 55, new sbyte[] {56}),
|
||||
/* NxS[ 99] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 100] */ new Table(1, 3, 58, new sbyte[] {59, 58, 60}),
|
||||
/* NxS[ 101] */ new Table(0, 7, 101, new sbyte[] {-1, 101, 61, 101, 101, 101,
|
||||
/* NxS[ 98] */ new Table(2, 1, 54, new sbyte[] {55}),
|
||||
/* NxS[ 99] */ new Table(8, 1, 56, new sbyte[] {57}),
|
||||
/* NxS[ 100] */ new Table(0, 0, -1, null),
|
||||
/* NxS[ 101] */ new Table(1, 3, 59, new sbyte[] {60, 59, 61}),
|
||||
/* NxS[ 102] */ new Table(0, 7, 102, new sbyte[] {-1, 102, 62, 102, 102, 102,
|
||||
-1}),
|
||||
};
|
||||
|
||||
|
|
@ -2064,24 +2065,27 @@ yylval = new Union(); yylval.op = new op_type_node(Operators.AssignmentAddition)
|
|||
return (int)Tokens.tkQuestionPoint;
|
||||
break;
|
||||
case 45:
|
||||
return (int)Tokens.tkDotDot;
|
||||
return (int)Tokens.tkQuestionSquareOpen;
|
||||
break;
|
||||
case 46:
|
||||
yylval = new Union(); yylval.op = new op_type_node(Operators.Assignment); return (int)Tokens.tkAssign;
|
||||
return (int)Tokens.tkDotDot;
|
||||
break;
|
||||
case 47:
|
||||
yylval = new Union(); yylval.op = new op_type_node(Operators.AssignmentMultiplication); return (int)Tokens.tkMultEqual;
|
||||
yylval = new Union(); yylval.op = new op_type_node(Operators.Assignment); return (int)Tokens.tkAssign;
|
||||
break;
|
||||
case 48:
|
||||
BEGIN(COMMENT1);
|
||||
yylval = new Union(); yylval.op = new op_type_node(Operators.AssignmentMultiplication); return (int)Tokens.tkMultEqual;
|
||||
break;
|
||||
case 49:
|
||||
BEGIN(COMMENT1);
|
||||
break;
|
||||
case 50:
|
||||
yylval = new Union();
|
||||
currentLexLocation = CurrentLexLocation;
|
||||
yylval.ex = parsertools.create_hex_const(yytext,currentLexLocation);
|
||||
return (int)Tokens.tkHex;
|
||||
break;
|
||||
case 50:
|
||||
case 51:
|
||||
if (parsertools.build_tree_for_formatter)
|
||||
break;
|
||||
|
||||
|
|
@ -2132,36 +2136,36 @@ if (parsertools.build_tree_for_formatter)
|
|||
Defines.Add(directiveparam);
|
||||
}
|
||||
break;
|
||||
case 51:
|
||||
case 52:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
case 52:
|
||||
case 53:
|
||||
yylval = new Union(); yylval.op = new op_type_node(Operators.AssignmentDivision); return (int)Tokens.tkDivEqual;
|
||||
break;
|
||||
case 53:
|
||||
case 54:
|
||||
{
|
||||
}
|
||||
break;
|
||||
case 54:
|
||||
BEGIN(INITIAL);
|
||||
break;
|
||||
case 55:
|
||||
case 56:
|
||||
{
|
||||
}
|
||||
break;
|
||||
case 57:
|
||||
BEGIN(INITIAL);
|
||||
break;
|
||||
case 58:
|
||||
case 59:
|
||||
case 60:
|
||||
case 56:
|
||||
case 57:
|
||||
{
|
||||
}
|
||||
break;
|
||||
case 58:
|
||||
BEGIN(INITIAL);
|
||||
break;
|
||||
case 59:
|
||||
case 60:
|
||||
case 61:
|
||||
{
|
||||
}
|
||||
break;
|
||||
case 62:
|
||||
parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam);
|
||||
parsertools.CheckDirectiveParams(directivename,directiveparam); // directivename in UPPERCASE!
|
||||
if (directivename == "IFDEF")
|
||||
|
|
@ -2193,7 +2197,7 @@ parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam);
|
|||
BEGIN(INITIAL);
|
||||
}
|
||||
break;
|
||||
case 62:
|
||||
case 63:
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,6 +186,7 @@ UNICODEARROW \x890
|
|||
"]" { return (int)Tokens.tkSquareClose; }
|
||||
"?" { return (int)Tokens.tkQuestion; }
|
||||
"?." { return (int)Tokens.tkQuestionPoint; }
|
||||
"?[" { return (int)Tokens.tkQuestionSquareOpen; }
|
||||
"@" { yylval = new Union(); yylval.op = new op_type_node(Operators.AddressOf); return (int)Tokens.tkAddressOf; }
|
||||
":=" { yylval = new Union(); yylval.op = new op_type_node(Operators.Assignment); return (int)Tokens.tkAssign; }
|
||||
"+=" { yylval = new Union(); yylval.op = new op_type_node(Operators.AssignmentAddition); return (int)Tokens.tkPlusEqual; }
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
%start parse_goal
|
||||
|
||||
%token <ti> tkDirectiveName tkAmpersend tkColon tkDotDot tkPoint tkRoundOpen tkRoundClose tkSemiColon tkSquareOpen tkSquareClose tkQuestion tkQuestionPoint
|
||||
%token <ti> tkDirectiveName tkAmpersend tkColon tkDotDot tkPoint tkRoundOpen tkRoundClose tkSemiColon tkSquareOpen tkSquareClose tkQuestion tkQuestionPoint tkQuestionSquareOpen
|
||||
%token <ti> tkSizeOf tkTypeOf tkWhere tkArray tkCase tkClass tkAuto tkConst tkConstructor tkDestructor tkElse tkExcept tkFile tkFor tkForeach tkFunction
|
||||
%token <ti> tkIf tkImplementation tkInherited tkInterface tkProcedure tkOperator tkProperty tkRaise tkRecord tkSet tkType tkThen tkUses tkVar tkWhile tkWith tkNil
|
||||
%token <ti> tkGoto tkOf tkLabel tkLock tkProgram tkEvent tkDefault tkTemplate tkPacked tkExports tkResourceString tkThreadvar tkSealed tkPartial tkTo tkDownto
|
||||
|
|
@ -3090,6 +3090,11 @@ variable
|
|||
}
|
||||
else $$ = new indexer($1 as addressed_value,el, @$);
|
||||
}
|
||||
| variable tkQuestionSquareOpen format_expr tkSquareClose
|
||||
{
|
||||
var fe = $3 as format_expr; // SSM 9/01/17
|
||||
$$ = new slice_expr_question($1 as addressed_value,fe.expr,fe.format1,fe.format2,@$);
|
||||
}
|
||||
| variable tkRoundOpen optional_expr_list tkRoundClose
|
||||
{
|
||||
$$ = new method_call($1 as addressed_value,$3 as expression_list, @$);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -151,6 +151,9 @@ script=
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -330,12 +330,12 @@
|
|||
</Node>
|
||||
<Node Name="Реализуем (a,b) := (1,2)" NL="0" NG="0">
|
||||
<Items>
|
||||
<Node Name="visit(assign_tuple" NL="0" NG="0">
|
||||
<Node Name="visit(assign_tuple" NL="0,9414063" NG="-1">
|
||||
<FileName>\treeconverter\treeconversion\syntax_tree_visitor.cs</FileName>
|
||||
<Text>public override void visit(SyntaxTree.assign_tuple _modern_proc_type)</Text>
|
||||
<Text>public override void visit(SyntaxTree.assign_tuple asstup)</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">public override void visit ( SyntaxTree . assign_tuple asstup )</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . AbstractVisitor</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . WalkingVisitorNew</i>
|
||||
<i Type="ClassOrNamespace">namespace PascalABCCompiler . TreeConverter</i>
|
||||
<i Type="CS_TreeNode">
|
||||
</i>
|
||||
|
|
@ -356,11 +356,53 @@
|
|||
</Node>
|
||||
<Node Name="Реализуем (var a, var b) := (1,2)" NL="0" NG="0">
|
||||
<Items>
|
||||
<Node ID="visit" Name="visit(SyntaxTree.assign_var_tuple" NL="0,9746094" NG="-1">
|
||||
<Node ID="visit" Name="visit(SyntaxTree.assign_var_tuple" NL="0,9414063" NG="-1">
|
||||
<FileName>\TreeConverter\TreeConversion\syntax_tree_visitor.cs</FileName>
|
||||
<Text>public override void visit(SyntaxTree.assign_var_tuple asstup)</Text>
|
||||
<Text>public override void visit(SyntaxTree.assign_var_tuple assvartup)</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">public override void visit ( SyntaxTree . assign_var_tuple asstup )</i>
|
||||
<i Type="Method">public override void visit ( SyntaxTree . assign_var_tuple assvartup )</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . WalkingVisitorNew</i>
|
||||
<i Type="ClassOrNamespace">namespace PascalABCCompiler . TreeConverter</i>
|
||||
<i Type="CS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node ID="visit" Name="for (var i=0; i<_statement_list.subnodes.Count" NL="0,9306641" NG="-1">
|
||||
<FileName>\TreeConverter\TreeConversion\syntax_tree_visitor.cs</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">public override void visit ( SyntaxTree . statement_list _statement_list )</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . WalkingVisitorNew</i>
|
||||
<i Type="ClassOrNamespace">namespace PascalABCCompiler . TreeConverter</i>
|
||||
<i Type="CS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node ID="visit" Name="Проверка на labelled_statement" NL="0,9423828" NG="-1">
|
||||
<FileName>\TreeConverter\TreeConversion\syntax_tree_visitor.cs</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">public override void visit ( SyntaxTree . labeled_statement _labeled_statement )</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . WalkingVisitorNew</i>
|
||||
<i Type="ClassOrNamespace">namespace PascalABCCompiler . TreeConverter</i>
|
||||
<i Type="CS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node ID="convert_strong" Name="convert_strong" NL="0,8408203" NG="-1">
|
||||
<FileName>\TreeConverter\TreeConversion\syntax_tree_visitor.cs</FileName>
|
||||
<Text>internal expression_node convert_strong(SyntaxTree.expression expr)</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">internal expression_node convert_strong ( SyntaxTree . expression expr )</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . WalkingVisitorNew</i>
|
||||
<i Type="ClassOrNamespace">namespace PascalABCCompiler . TreeConverter</i>
|
||||
<i Type="CS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node ID="visit" Name="LambdaProcessingState.TypeInferencePhase" NL="0,9238281" NG="-1">
|
||||
<FileName>\TreeConverter\TreeConversion\syntax_tree_visitor.cs</FileName>
|
||||
<Text>case LambdaProcessingState.TypeInferencePhase:</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">public override void visit ( SyntaxTree . function_lambda_definition _function_lambda_definition )</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . WalkingVisitorNew</i>
|
||||
<i Type="ClassOrNamespace">namespace PascalABCCompiler . TreeConverter</i>
|
||||
<i Type="CS_TreeNode">
|
||||
|
|
@ -434,12 +476,11 @@
|
|||
</Node>
|
||||
<Node Name="foreach" NL="0" NG="0">
|
||||
<Items>
|
||||
<Node Name="visit(foreach_stmt" NL="0" NG="0">
|
||||
<Node ID="visit" Name="visit(foreach_stmt" NL="0,9033203" NG="-1">
|
||||
<FileName>\TreeConverter\TreeConversion\syntax_tree_visitor.cs</FileName>
|
||||
<Text>public override void visit(SyntaxTree.foreach_stmt _foreach_stmt)</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">public override void visit ( SyntaxTree . foreach_stmt _foreach_stmt )</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . AbstractVisitor</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . WalkingVisitorNew</i>
|
||||
<i Type="ClassOrNamespace">namespace PascalABCCompiler . TreeConverter</i>
|
||||
<i Type="CS_TreeNode">
|
||||
</i>
|
||||
|
|
@ -1300,11 +1341,12 @@
|
|||
</Node>
|
||||
<Node Name="[::]" NL="0" NG="0">
|
||||
<Items>
|
||||
<Node Name="visit(slice_expr" NL="0" NG="0">
|
||||
<Node Name="visit(slice_expr" NL="0,9521484" NG="-1">
|
||||
<FileName>\treeconverter\treeconversion\syntax_tree_visitor.cs</FileName>
|
||||
<Text>public override void visit(SyntaxTree.slice_expr sl)</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">public override void visit ( SyntaxTree . slice_expr sl )</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . AbstractVisitor</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . WalkingVisitorNew</i>
|
||||
<i Type="ClassOrNamespace">namespace PascalABCCompiler . TreeConverter</i>
|
||||
<i Type="CS_TreeNode">
|
||||
</i>
|
||||
|
|
@ -1433,9 +1475,9 @@
|
|||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="visit(vdarr);" NL="0,9033203" NG="0">
|
||||
<Node Name="visit(vdarr);" NL="0,9033203" NG="-1">
|
||||
<FileName>\treeconverter\treeconversion\syntax_tree_visitor.cs</FileName>
|
||||
<Text>visit(vdarr);</Text>
|
||||
<Text>//visit(vdarr);</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">public override void visit ( SyntaxTree . foreach_stmt _foreach_stmt )</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . WalkingVisitorNew</i>
|
||||
|
|
@ -1444,39 +1486,17 @@
|
|||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="foreach (statement syntax_statement" NL="0,9306641" NG="0">
|
||||
<FileName>\TreeConverter\TreeConversion\syntax_tree_visitor.cs</FileName>
|
||||
<Text>foreach (statement syntax_statement in _statement_list.subnodes)</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">public override void visit ( SyntaxTree . statement_list _statement_list )</i>
|
||||
<i Type="ClassOrNamespace">public class syntax_tree_visitor : SyntaxTree . WalkingVisitorNew</i>
|
||||
<i Type="ClassOrNamespace">namespace PascalABCCompiler . TreeConverter</i>
|
||||
<i Type="CS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="FindIndex" NL="0,5634766" NG="0,5947266">
|
||||
<Node Name="FindIndex" NL="0,4765625" NG="0,5576172">
|
||||
<FileName>\SyntaxTree\tree\TreeHelper.cs</FileName>
|
||||
<Text>public int FindIndex(syntax_tree_node node)</Text>
|
||||
<Text>public int FindIndex(syntax_tree_node node, Desc d = Desc.All)</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">public int FindIndex ( syntax_tree_node node )</i>
|
||||
<i Type="Method">public int FindIndex ( syntax_tree_node node , Desc d = Desc . All )</i>
|
||||
<i Type="ClassOrNamespace">public partial class syntax_tree_node</i>
|
||||
<i Type="ClassOrNamespace">namespace PascalABCCompiler . SyntaxTree</i>
|
||||
<i Type="CS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="switch (action)" NL="0,7285156" NG="0,5">
|
||||
<FileName>\Parsers\PascalABCParserNewSaushkin\ABCPascalYacc.cs</FileName>
|
||||
<Text>switch (action)</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">protected override void DoAction ( int action )</i>
|
||||
<i Type="ClassOrNamespace">public partial class GPPGParser : ShiftReduceParser < PascalABCSavParser . Union , LexLocation ></i>
|
||||
<i Type="ClassOrNamespace">namespace GPPGParserScanner</i>
|
||||
<i Type="CS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
</Items>
|
||||
</Node>
|
||||
</AspectFile>
|
||||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.2.0.1371'
|
||||
!define VERSION '3.2.0.1372'
|
||||
|
|
|
|||
|
|
@ -1092,6 +1092,11 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
DefaultVisit(_assign_var_tuple);
|
||||
}
|
||||
|
||||
public virtual void visit(slice_expr_question _slice_expr_question)
|
||||
{
|
||||
DefaultVisit(_slice_expr_question);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,24 +32,6 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
upper.ReplaceDescendant(from, to);
|
||||
}
|
||||
|
||||
public void ReplaceStatement(statement from, IEnumerable<statement> to, Desc d = Desc.DirectDescendants)
|
||||
{
|
||||
foreach (var x in to)
|
||||
x.Parent = from.Parent;
|
||||
var sl = from.Parent as statement_list;
|
||||
if (sl != null)
|
||||
{
|
||||
sl.ReplaceInList(from, to);
|
||||
}
|
||||
else
|
||||
{
|
||||
var l = new statement_list();
|
||||
l.AddMany(to);
|
||||
l.source_context = from.source_context;
|
||||
from.Parent.ReplaceDescendant(from, l, d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ReplaceStatement(statement from, statement to)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1741,6 +1741,14 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
{
|
||||
}
|
||||
|
||||
public virtual void pre_do_visit(slice_expr_question _slice_expr_question)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void post_do_visit(slice_expr_question _slice_expr_question)
|
||||
{
|
||||
}
|
||||
|
||||
public override void visit(syntax_tree_node _syntax_tree_node)
|
||||
{
|
||||
DefaultVisit(_syntax_tree_node);
|
||||
|
|
@ -3599,6 +3607,17 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
pre_do_visit(_assign_var_tuple);
|
||||
post_do_visit(_assign_var_tuple);
|
||||
}
|
||||
|
||||
public override void visit(slice_expr_question _slice_expr_question)
|
||||
{
|
||||
DefaultVisit(_slice_expr_question);
|
||||
pre_do_visit(_slice_expr_question);
|
||||
visit(slice_expr_question.v);
|
||||
visit(slice_expr_question.from);
|
||||
visit(slice_expr_question.to);
|
||||
visit(slice_expr_question.step);
|
||||
post_do_visit(_slice_expr_question);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -454,6 +454,8 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
return new yield_sequence_node();
|
||||
case 216:
|
||||
return new assign_var_tuple();
|
||||
case 217:
|
||||
return new slice_expr_question();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -3831,6 +3833,21 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
read_assign_tuple(_assign_var_tuple);
|
||||
}
|
||||
|
||||
|
||||
public void visit(slice_expr_question _slice_expr_question)
|
||||
{
|
||||
read_slice_expr_question(_slice_expr_question);
|
||||
}
|
||||
|
||||
public void read_slice_expr_question(slice_expr_question _slice_expr_question)
|
||||
{
|
||||
read_dereference(_slice_expr_question);
|
||||
_slice_expr_question.v = _read_node() as addressed_value;
|
||||
_slice_expr_question.from = _read_node() as expression;
|
||||
_slice_expr_question.to = _read_node() as expression;
|
||||
_slice_expr_question.step = _read_node() as expression;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5991,6 +5991,54 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
write_assign_tuple(_assign_var_tuple);
|
||||
}
|
||||
|
||||
|
||||
public void visit(slice_expr_question _slice_expr_question)
|
||||
{
|
||||
bw.Write((Int16)217);
|
||||
write_slice_expr_question(_slice_expr_question);
|
||||
}
|
||||
|
||||
public void write_slice_expr_question(slice_expr_question _slice_expr_question)
|
||||
{
|
||||
write_dereference(_slice_expr_question);
|
||||
if (_slice_expr_question.v == null)
|
||||
{
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
_slice_expr_question.v.visit(this);
|
||||
}
|
||||
if (_slice_expr_question.from == null)
|
||||
{
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
_slice_expr_question.from.visit(this);
|
||||
}
|
||||
if (_slice_expr_question.to == null)
|
||||
{
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
_slice_expr_question.to.visit(this);
|
||||
}
|
||||
if (_slice_expr_question.step == null)
|
||||
{
|
||||
bw.Write((byte)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
bw.Write((byte)1);
|
||||
_slice_expr_question.step.visit(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10467,7 +10467,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
///<param name="visitor">Объект-посетитель.</param>
|
||||
///<returns>Return value is void</returns>
|
||||
public override void visit(IVisitor visitor)
|
||||
{
|
||||
{
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
|
|
@ -38358,6 +38358,261 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
}
|
||||
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
[Serializable]
|
||||
public partial class slice_expr_question : dereference
|
||||
{
|
||||
|
||||
///<summary>
|
||||
///Конструктор без параметров.
|
||||
///</summary>
|
||||
public slice_expr_question()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public slice_expr_question(addressed_value _v,expression _from,expression _to,expression _step)
|
||||
{
|
||||
this._v=_v;
|
||||
this._from=_from;
|
||||
this._to=_to;
|
||||
this._step=_step;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public slice_expr_question(addressed_value _v,expression _from,expression _to,expression _step,SourceContext sc)
|
||||
{
|
||||
this._v=_v;
|
||||
this._from=_from;
|
||||
this._to=_to;
|
||||
this._step=_step;
|
||||
source_context = sc;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public slice_expr_question(addressed_value _dereferencing_value,addressed_value _v,expression _from,expression _to,expression _step)
|
||||
{
|
||||
this._dereferencing_value=_dereferencing_value;
|
||||
this._v=_v;
|
||||
this._from=_from;
|
||||
this._to=_to;
|
||||
this._step=_step;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Конструктор с параметрами.
|
||||
///</summary>
|
||||
public slice_expr_question(addressed_value _dereferencing_value,addressed_value _v,expression _from,expression _to,expression _step,SourceContext sc)
|
||||
{
|
||||
this._dereferencing_value=_dereferencing_value;
|
||||
this._v=_v;
|
||||
this._from=_from;
|
||||
this._to=_to;
|
||||
this._step=_step;
|
||||
source_context = sc;
|
||||
}
|
||||
protected addressed_value _v;
|
||||
protected expression _from;
|
||||
protected expression _to;
|
||||
protected expression _step;
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public addressed_value v
|
||||
{
|
||||
get
|
||||
{
|
||||
return _v;
|
||||
}
|
||||
set
|
||||
{
|
||||
_v=value;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public expression from
|
||||
{
|
||||
get
|
||||
{
|
||||
return _from;
|
||||
}
|
||||
set
|
||||
{
|
||||
_from=value;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public expression to
|
||||
{
|
||||
get
|
||||
{
|
||||
return _to;
|
||||
}
|
||||
set
|
||||
{
|
||||
_to=value;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///
|
||||
///</summary>
|
||||
public expression step
|
||||
{
|
||||
get
|
||||
{
|
||||
return _step;
|
||||
}
|
||||
set
|
||||
{
|
||||
_step=value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary> Создает копию узла </summary>
|
||||
public override syntax_tree_node Clone()
|
||||
{
|
||||
slice_expr_question copy = new slice_expr_question();
|
||||
copy.Parent = this.Parent;
|
||||
if (source_context != null)
|
||||
copy.source_context = new SourceContext(source_context);
|
||||
if (attributes != null)
|
||||
{
|
||||
copy.attributes = (attribute_list)attributes.Clone();
|
||||
copy.attributes.Parent = copy;
|
||||
}
|
||||
if (dereferencing_value != null)
|
||||
{
|
||||
copy.dereferencing_value = (addressed_value)dereferencing_value.Clone();
|
||||
copy.dereferencing_value.Parent = copy;
|
||||
}
|
||||
if (v != null)
|
||||
{
|
||||
copy.v = (addressed_value)v.Clone();
|
||||
copy.v.Parent = copy;
|
||||
}
|
||||
if (from != null)
|
||||
{
|
||||
copy.from = (expression)from.Clone();
|
||||
copy.from.Parent = copy;
|
||||
}
|
||||
if (to != null)
|
||||
{
|
||||
copy.to = (expression)to.Clone();
|
||||
copy.to.Parent = copy;
|
||||
}
|
||||
if (step != null)
|
||||
{
|
||||
copy.step = (expression)step.Clone();
|
||||
copy.step.Parent = copy;
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
/// <summary> Получает копию данного узла корректного типа </summary>
|
||||
public new slice_expr_question TypedClone()
|
||||
{
|
||||
return Clone() as slice_expr_question;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Свойство для получения количества всех подузлов без элементов поля типа List
|
||||
///</summary>
|
||||
public override Int32 subnodes_without_list_elements_count
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
///Свойство для получения количества всех подузлов. Подузлом также считается каждый элемент поля типа List
|
||||
///</summary>
|
||||
public override Int32 subnodes_count
|
||||
{
|
||||
get
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
///Индексатор для получения всех подузлов
|
||||
///</summary>
|
||||
public override syntax_tree_node this[Int32 ind]
|
||||
{
|
||||
get
|
||||
{
|
||||
if(subnodes_count == 0 || ind < 0 || ind > subnodes_count-1)
|
||||
throw new IndexOutOfRangeException();
|
||||
switch(ind)
|
||||
{
|
||||
case 0:
|
||||
return dereferencing_value;
|
||||
case 1:
|
||||
return v;
|
||||
case 2:
|
||||
return from;
|
||||
case 3:
|
||||
return to;
|
||||
case 4:
|
||||
return step;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(subnodes_count == 0 || ind < 0 || ind > subnodes_count-1)
|
||||
throw new IndexOutOfRangeException();
|
||||
switch(ind)
|
||||
{
|
||||
case 0:
|
||||
dereferencing_value = (addressed_value)value;
|
||||
break;
|
||||
case 1:
|
||||
v = (addressed_value)value;
|
||||
break;
|
||||
case 2:
|
||||
from = (expression)value;
|
||||
break;
|
||||
case 3:
|
||||
to = (expression)value;
|
||||
break;
|
||||
case 4:
|
||||
step = (expression)value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
///<summary>
|
||||
///Метод для обхода дерева посетителем
|
||||
///</summary>
|
||||
///<param name="visitor">Объект-посетитель.</param>
|
||||
///<returns>Return value is void</returns>
|
||||
public override void visit(IVisitor visitor)
|
||||
{
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1621,6 +1621,7 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
public partial class expression
|
||||
{
|
||||
public object semantic_ex = null; // 3.01.17 convert_strong, вызванная первый раз, заполняет это поле, а потом только обращается к нему
|
||||
public expression Plus(expression e)
|
||||
{
|
||||
return new bin_expr(this, e, Operators.Plus);
|
||||
|
|
|
|||
|
|
@ -1306,6 +1306,12 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
///<param name="_assign_var_tuple">Node to visit</param>
|
||||
///<returns> Return value is void </returns>
|
||||
void visit(assign_var_tuple _assign_var_tuple);
|
||||
///<summary>
|
||||
///Method to visit slice_expr_question.
|
||||
///</summary>
|
||||
///<param name="_slice_expr_question">Node to visit</param>
|
||||
///<returns> Return value is void </returns>
|
||||
void visit(slice_expr_question _slice_expr_question);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,8 +38,9 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
|
||||
public override void DefaultVisit(syntax_tree_node n)
|
||||
{
|
||||
var count = n.subnodes_count;
|
||||
for (var i = 0; i < count; i++)
|
||||
// n.subnodes_count может меняться в процессе работы этого алгоритма
|
||||
// В частности, в результате ReplaceStatementWithParent
|
||||
for (var i = 0; i < n.subnodes_count; i++)
|
||||
ProcessNode(n[i]);
|
||||
}
|
||||
|
||||
|
|
@ -50,6 +51,25 @@ namespace PascalABCCompiler.SyntaxTree
|
|||
throw new Exception("У корневого элемента нельзя получить Parent");
|
||||
from.Parent.ReplaceDescendant(from, to);
|
||||
}
|
||||
|
||||
public void ReplaceStatementUsingParent(statement from, IEnumerable<statement> to, Desc d = Desc.DirectDescendants)
|
||||
{
|
||||
foreach (var x in to)
|
||||
x.Parent = from.Parent;
|
||||
var sl = from.Parent as statement_list;
|
||||
if (sl != null)
|
||||
{
|
||||
sl.ReplaceInList(from, to);
|
||||
}
|
||||
else
|
||||
{
|
||||
var l = new statement_list();
|
||||
l.AddMany(to);
|
||||
l.source_context = from.source_context;
|
||||
from.Parent.ReplaceDescendant(from, l, d);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
36
TestSuite/SliceQuestion.pas
Normal file
36
TestSuite/SliceQuestion.pas
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
begin
|
||||
//var s := '012345';
|
||||
var a:= Arr(0,1,2,3,4,5);
|
||||
var a1 := a?[-1:];
|
||||
Assert(a1.SequenceEqual(Seq(0,1,2,3,4,5)));
|
||||
a1 := a?[1:6];
|
||||
Assert(a1.SequenceEqual(Seq(1,2,3,4,5)));
|
||||
a1 := a?[-2::2];
|
||||
Assert(a1.SequenceEqual(Seq(0,2,4)));
|
||||
a1 := a?[3:-2:-1];
|
||||
Assert(a1.SequenceEqual(Seq(3,2,1,0)));
|
||||
a1 := a?[4:-2:-2];
|
||||
Assert(a1.SequenceEqual(Seq(4,2,0)));
|
||||
var l:= Lst(0,1,2,3,4,5);
|
||||
var l1 := l?[-1:];
|
||||
Assert(l1.SequenceEqual(Seq(0,1,2,3,4,5)));
|
||||
l1 := l?[1:6];
|
||||
Assert(l1.SequenceEqual(Seq(1,2,3,4,5)));
|
||||
l1 := l?[-2::2];
|
||||
Assert(l1.SequenceEqual(Seq(0,2,4)));
|
||||
l1 := l?[3:-2:-1];
|
||||
Assert(l1.SequenceEqual(Seq(3,2,1,0)));
|
||||
l1 := l?[4:-2:-2];
|
||||
Assert(l1.SequenceEqual(Seq(4,2,0)));
|
||||
var s := '012345';
|
||||
var s1 := s?[-1:];
|
||||
Assert(s1.Equals('012345'));
|
||||
s1 := s?[2:7];
|
||||
Assert(s1.Equals('12345'));
|
||||
s1 := s?[-1::2];
|
||||
Assert(s1.Equals('024'));
|
||||
s1 := s?[4:-2:-1];
|
||||
Assert(s1.Equals('3210'));
|
||||
s1 := s?[5:-2:-2];
|
||||
Assert(s1.Equals('420'));
|
||||
end.
|
||||
|
|
@ -808,14 +808,17 @@ namespace PascalABCCompiler.TreeConverter
|
|||
throw new CompilerInternalError("This syntax tree node can not be null.");
|
||||
}
|
||||
#endif
|
||||
//if (expr.semantic_ex != null) // SSM 3.1.17 - возвращаем кешированное значение
|
||||
// return expr.semantic_ex as expression_node;
|
||||
|
||||
convertion_data_and_alghoritms.check_node_parser_error(expr);
|
||||
|
||||
//Посмотреть, может вызвать ошибку
|
||||
//ssyy
|
||||
motivation_keeper.reset();
|
||||
motivation_keeper.reset(); // Это можно закомментировать - все тесты проходят SSM 2/1/17
|
||||
//\ssyy
|
||||
expression_node en = ret.visit(expr);
|
||||
//expr.semantic_ex = en; // SSM 3.1.17 кешируем для последующего обращения
|
||||
|
||||
//en.loc=get_location(expr);
|
||||
|
||||
|
|
@ -3133,7 +3136,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
//statement_node sn=convert_strong(_procedure_call.func_name);
|
||||
statement_node sn = convert_strong(mc);
|
||||
//проверяем на слукчай вызова типа real(a) ...
|
||||
//проверяем на случай вызова типа real(a) ...
|
||||
if (/*((sn is base_function_call) && (sn as base_function_call).IsExplicitConversion)
|
||||
|| (sn is SemanticTree.IReferenceNode)
|
||||
|| (sn is SemanticTree.IGetAddrNode)
|
||||
|
|
@ -8316,7 +8319,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
convertion_data_and_alghoritms.check_node_parser_error(_labeled_statement.label_name);
|
||||
SymbolInfo si = context.CurrentScope.FindOnlyInScopeAndBlocks(_labeled_statement.label_name.name);
|
||||
if (_labeled_statement.to_statement is SyntaxTree.var_statement)
|
||||
if (_labeled_statement.to_statement is SyntaxTree.var_statement || _labeled_statement.to_statement is SyntaxTree.assign_var_tuple)
|
||||
{
|
||||
AddError(get_location(_labeled_statement.label_name), "LABELED_DECLARATION_NOT_ALLOWED");
|
||||
}
|
||||
|
|
@ -16702,6 +16705,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
var fornode = new SyntaxTree.for_node(i, 0, high, newbody, for_cycle_type.to, null, null, true);
|
||||
|
||||
var stl = new SyntaxTree.statement_list(vdarr, fornode);
|
||||
// Замена 1 оператора на 1 оператор. Всё хороо даже если оператор помечен меткой
|
||||
ReplaceByVisitor(_foreach_stmt, stl);
|
||||
|
||||
visit(stl);
|
||||
|
|
@ -19118,7 +19122,6 @@ namespace PascalABCCompiler.TreeConverter
|
|||
var t = ConvertSemanticTypeNodeToNETType(expr.type);
|
||||
if (t == null)
|
||||
AddError(expr.location, "TUPLE_EXPECTED");
|
||||
//if (t != typeof(System.Tuple<>))
|
||||
if (!t.FullName.StartsWith("System.Tuple"))
|
||||
AddError(expr.location, "TUPLE_EXPECTED");
|
||||
|
||||
|
|
@ -19128,8 +19131,8 @@ namespace PascalABCCompiler.TreeConverter
|
|||
|
||||
var tname = "#temp_var" + UniqueNumStr();
|
||||
|
||||
var tt = new var_statement(new ident(tname), new semantic_addr_value(expr)); // тут semantic_addr_value хранит на самом деле expr - просто неудачное название
|
||||
|
||||
//var tt = new var_statement(new ident(tname), new semantic_addr_value(expr)); // тут semantic_addr_value хранит на самом деле expr - просто неудачное название
|
||||
var tt = new var_statement(new ident(tname), asstup.expr); // тут semantic_addr_value хранит на самом деле expr - просто неудачное название
|
||||
var st = new statement_list(tt);
|
||||
for (var i = 0; i < n; i++)
|
||||
{
|
||||
|
|
@ -19139,13 +19142,16 @@ namespace PascalABCCompiler.TreeConverter
|
|||
st.Add(a);
|
||||
}
|
||||
visit(st);
|
||||
// Замена 1 оператор на 1 оператор - всё OK
|
||||
ReplaceByVisitor(asstup, st);
|
||||
}
|
||||
|
||||
public override void visit(SyntaxTree.assign_var_tuple asstup)
|
||||
public override void visit(SyntaxTree.assign_var_tuple assvartup)
|
||||
{
|
||||
// Проверить, что справа - Tuple
|
||||
var expr = convert_strong(asstup.expr);
|
||||
var expr = convert_strong(assvartup.expr);
|
||||
expr = convert_if_typed_expression_to_function_call(expr);
|
||||
|
||||
var t = ConvertSemanticTypeNodeToNETType(expr.type);
|
||||
if (t == null)
|
||||
AddError(expr.location, "TUPLE_EXPECTED");
|
||||
|
|
@ -19153,102 +19159,169 @@ namespace PascalABCCompiler.TreeConverter
|
|||
if (!t.FullName.StartsWith("System.Tuple"))
|
||||
AddError(expr.location, "TUPLE_EXPECTED");
|
||||
|
||||
var n = asstup.vars.variables.Count();
|
||||
var n = assvartup.vars.variables.Count();
|
||||
if (n > t.GetGenericArguments().Count())
|
||||
AddError(get_location(asstup.vars), "TOO_MANY_ELEMENTS_ON_LEFT_SIDE_OF_TUPLE_ASSIGNMRNT");
|
||||
AddError(get_location(assvartup.vars), "TOO_MANY_ELEMENTS_ON_LEFT_SIDE_OF_TUPLE_ASSIGNMRNT");
|
||||
|
||||
var tname = "#temp_var" + UniqueNumStr();
|
||||
|
||||
var tt = new var_statement(new ident(tname), new semantic_addr_value(expr)); // тут semantic_addr_value хранит на самом деле expr - просто неудачное название
|
||||
var tt = new var_statement(new ident(tname), assvartup.expr); // тут для assvartup.expr внутри повторно вызывается convert_strong, это плохо, но если там лямбда, то иначе - с semantic_addr_value - не работает!!!
|
||||
//var tt = new var_statement(new ident(tname), new semantic_addr_value(expr)); // тут semantic_addr_value хранит на самом деле expr - просто неудачное название
|
||||
visit(tt); // обходится первый элемент - вместо asstup
|
||||
|
||||
var sl = new List<statement>();
|
||||
sl.Add(tt); // он же помещается в новое синтаксическое дерево
|
||||
for (var i = 0; i < n; i++)
|
||||
{
|
||||
var rr = asstup.vars.variables[i] as ident;
|
||||
var rr = assvartup.vars.variables[i] as ident;
|
||||
var a = new var_statement(rr,
|
||||
new dot_node(new ident(tname),new ident("Item" + (i + 1).ToString())),
|
||||
asstup.vars.variables[i].source_context
|
||||
new dot_node(new ident(tname),new ident("Item" + (i + 1).ToString())),
|
||||
assvartup.vars.variables[i].source_context
|
||||
);
|
||||
//visit(a); // Остальные элементы обходить не надо - они обходятся на следующих итерациях при обходе внешнего statement_list
|
||||
sl.Add(a);
|
||||
}
|
||||
var ssl = asstup.Parent as SyntaxTree.statement_list;
|
||||
ssl.ReplaceInList(asstup, sl); // Всё обходится вперёд, поэтому все операторы кроме первого обойдутся автоматически
|
||||
ReplaceStatementUsingParent(assvartup, sl);
|
||||
}
|
||||
|
||||
public override void visit(SyntaxTree.slice_expr sl)
|
||||
{
|
||||
// Новое
|
||||
// Последовательности исключены
|
||||
// Преобразуется в вызов a.SystemSlice(situation,from,to,step)
|
||||
// Тип a должен быть array of T, List<T> или string
|
||||
// situation = 0 - ничего не пропущено
|
||||
// situation = 1 - пропущен from
|
||||
// situation = 2 - пропущен to
|
||||
// situation = 3 - пропущены from и to
|
||||
// пропущенность кодируется тем, что в соответствующем поле int.MaxValue
|
||||
// Пропущенность кодируется тем, что в соответствующем поле - int.MaxValue
|
||||
// step может просто отсутствовать - это параметр по умолчанию в SystemSlice
|
||||
|
||||
var semvar = convert_strong(sl.v);
|
||||
if (semvar is typed_expression)
|
||||
semvar = convert_typed_expression_to_function_call(semvar as typed_expression);
|
||||
|
||||
var semvartype = semvar.type;
|
||||
var t = ConvertSemanticTypeNodeToNETType(semvar.type);
|
||||
|
||||
// semvartype должен быть array of T, List<T> или string
|
||||
|
||||
var IsSlicedType = 0; // проверим, является ли semvartype динамическим массивом, списком List или строкой
|
||||
|
||||
var t = ConvertSemanticTypeNodeToNETType(semvartype);
|
||||
|
||||
if (t.IsArray)
|
||||
var IsSlicedType = 0; // проверим, является ли semvar.type динамическим массивом, списком List или строкой
|
||||
// semvar.type должен быть array of T, List<T> или string
|
||||
if (t == null)
|
||||
IsSlicedType = 0; // можно ничего не присваивать :)
|
||||
else if (t.IsArray)
|
||||
IsSlicedType = 1;
|
||||
else if (t == typeof(System.String))
|
||||
IsSlicedType = 2;
|
||||
else if (t.IsGenericType && t.GetGenericTypeDefinition()==typeof(System.Collections.Generic.List<>))
|
||||
else if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(System.Collections.Generic.List<>))
|
||||
IsSlicedType = 3;
|
||||
|
||||
if (IsSlicedType==0)
|
||||
AddError(get_location(sl.v), "BAD_SLICE_OBJECT");
|
||||
|
||||
int situation = 0;
|
||||
|
||||
if ((sl.from is int32_const) && (sl.from as int32_const).val==int.MaxValue)
|
||||
situation += 1;
|
||||
if ((sl.to is int32_const) && (sl.to as int32_const).val == int.MaxValue)
|
||||
situation += 2;
|
||||
|
||||
var el = new SyntaxTree.expression_list();
|
||||
el.Add(new int32_const(situation));
|
||||
|
||||
var semfrom = convert_strong(sl.from);
|
||||
var b = convertion_data_and_alghoritms.can_convert_type(semfrom, SystemLibrary.SystemLibrary.integer_type);
|
||||
if (!b)
|
||||
AddError(get_location(sl.from), "INTEGER_VALUE_EXPECTED");
|
||||
|
||||
el.Add(sl.from); // Это плохо - считается 2 раза. Надо делать semantic_expr_node !!!
|
||||
|
||||
var semto = convert_strong(sl.to);
|
||||
b = convertion_data_and_alghoritms.can_convert_type(semto, SystemLibrary.SystemLibrary.integer_type);
|
||||
if (!b)
|
||||
AddError(get_location(sl.to), "INTEGER_VALUE_EXPECTED");
|
||||
|
||||
el.Add(sl.to);
|
||||
|
||||
if (sl.step != null)
|
||||
{
|
||||
var semstep = convert_strong(sl.step);
|
||||
b = convertion_data_and_alghoritms.can_convert_type(semstep, SystemLibrary.SystemLibrary.integer_type);
|
||||
if (!b)
|
||||
AddError(get_location(sl.step), "INTEGER_VALUE_EXPECTED");
|
||||
|
||||
el.Add(sl.step);
|
||||
}
|
||||
|
||||
int situation = 0;
|
||||
|
||||
if ((sl.from is int32_const) && (sl.from as int32_const).val == int.MaxValue)
|
||||
situation += 1;
|
||||
if ((sl.to is int32_const) && (sl.to as int32_const).val == int.MaxValue)
|
||||
situation += 2;
|
||||
|
||||
var el = new SyntaxTree.expression_list();
|
||||
el.Add(new int32_const(situation));
|
||||
el.Add(sl.from); // Это плохо - считается 2 раза. Надо делать semantic_expr_node !!!? Нет!!!
|
||||
// Если там будет лямбда, то не будет работать - известно, что semantic_expr_node не работает с лямбдами
|
||||
// т.к. они несколько раз обходят код.
|
||||
el.Add(sl.to);
|
||||
if (sl.step != null)
|
||||
el.Add(sl.step);
|
||||
|
||||
var mc = new method_call(new dot_node(sl.v, new ident("SystemSlice", sl.v.source_context), sl.v.source_context), el, sl.source_context);
|
||||
visit(mc);
|
||||
}
|
||||
|
||||
public override void visit(SyntaxTree.slice_expr_question sl)
|
||||
{
|
||||
// Преобразуется в вызов a.SystemSlice(situation,from,to,step)
|
||||
// Тип a должен быть array of T, List<T> или string
|
||||
// situation = 0 - ничего не пропущено
|
||||
// situation = 1 - пропущен from
|
||||
// situation = 2 - пропущен to
|
||||
// situation = 3 - пропущены from и to
|
||||
// Пропущенность кодируется тем, что в соответствующем поле - int.MaxValue
|
||||
// step может просто отсутствовать - это параметр по умолчанию в SystemSlice
|
||||
|
||||
var semvar = convert_strong(sl.v);
|
||||
if (semvar is typed_expression)
|
||||
semvar = convert_typed_expression_to_function_call(semvar as typed_expression);
|
||||
|
||||
var t = ConvertSemanticTypeNodeToNETType(semvar.type);
|
||||
|
||||
var IsSlicedType = 0; // проверим, является ли semvar.type динамическим массивом, списком List или строкой
|
||||
// semvar.type должен быть array of T, List<T> или string
|
||||
if (t == null)
|
||||
IsSlicedType = 0; // можно ничего не присваивать :)
|
||||
else if (t.IsArray)
|
||||
IsSlicedType = 1;
|
||||
else if (t == typeof(System.String))
|
||||
IsSlicedType = 2;
|
||||
else if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(System.Collections.Generic.List<>))
|
||||
IsSlicedType = 3;
|
||||
|
||||
if (IsSlicedType == 0)
|
||||
AddError(get_location(sl.v), "BAD_SLICE_OBJECT");
|
||||
|
||||
var semfrom = convert_strong(sl.from);
|
||||
var b = convertion_data_and_alghoritms.can_convert_type(semfrom, SystemLibrary.SystemLibrary.integer_type);
|
||||
if (!b)
|
||||
AddError(get_location(sl.from), "INTEGER_VALUE_EXPECTED");
|
||||
|
||||
var semto = convert_strong(sl.to);
|
||||
b = convertion_data_and_alghoritms.can_convert_type(semto, SystemLibrary.SystemLibrary.integer_type);
|
||||
if (!b)
|
||||
AddError(get_location(sl.to), "INTEGER_VALUE_EXPECTED");
|
||||
|
||||
if (sl.step != null)
|
||||
{
|
||||
var semstep = convert_strong(sl.step);
|
||||
b = convertion_data_and_alghoritms.can_convert_type(semstep, SystemLibrary.SystemLibrary.integer_type);
|
||||
if (!b)
|
||||
AddError(get_location(sl.step), "INTEGER_VALUE_EXPECTED");
|
||||
}
|
||||
|
||||
int situation = 0;
|
||||
|
||||
if ((sl.from is int32_const) && (sl.from as int32_const).val == int.MaxValue)
|
||||
situation += 1;
|
||||
if ((sl.to is int32_const) && (sl.to as int32_const).val == int.MaxValue)
|
||||
situation += 2;
|
||||
|
||||
var el = new SyntaxTree.expression_list();
|
||||
el.Add(new int32_const(situation));
|
||||
el.Add(sl.from); // Это плохо - считается 2 раза. Надо делать semantic_expr_node !!!? Нет!!!
|
||||
// Если там будет лямбда, то не будет работать - известно, что semantic_expr_node не работает с лямбдами
|
||||
// т.к. они несколько раз обходят код.
|
||||
el.Add(sl.to);
|
||||
if (sl.step != null)
|
||||
el.Add(sl.step);
|
||||
|
||||
var mc = new method_call(new dot_node(sl.v, new ident("SystemSliceQuestion", sl.v.source_context), sl.v.source_context), el, sl.source_context);
|
||||
visit(mc);
|
||||
}
|
||||
|
||||
// frninja 04/03/16 - для yield
|
||||
|
||||
// frninja 06/06/16 - фикс для видимости private методов и полей с классов в том же модуле
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -2346,101 +2346,10 @@
|
|||
</Node>
|
||||
<Node Name="Slices">
|
||||
<Items>
|
||||
<Node Name="Slice<T>(Self: sequence of T">
|
||||
<Node Name="CreateSliceFromListInternal">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function Slice<T>(Self: sequence of T; from,step: integer): sequence of T; extensionmethod;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function Slice < T > ( Self : sequence of T ; from , step : integer ) : sequence of T extensionmethod</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="Slice<T>(Self: List<T>">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function Slice<T>(Self: List<T>; from,step,count: integer): List<T>; extensionmethod;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function Slice < T > ( Self : List < T > ; from , step , count : integer ) : List < T > extensionmethod</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="Slice<T>(Self: array of T">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function Slice<T>(Self: array of T; from,step: integer): array of T; extensionmethod;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function Slice < T > ( Self : array of T ; from , step : integer ) : array of T extensionmethod</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="Slice(Self: string;">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function Slice(Self: string; from,step: integer): string; extensionmethod;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function Slice ( Self : string ; from , step : integer ) : string extensionmethod</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="CalcCountForSystemSlice">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function CalcCountForSystemSlice(situation: integer; Len: integer; var from,&to: integer; step: integer): integer;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function CalcCountForSystemSlice ( situation : integer ; Len : integer ; var from , &to : integer ; step : integer ) : integer</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SliceListImpl<T>(Self: List<T>">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SliceListImpl<T>(Self: List<T>; from,step,count: integer): List<T>;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SliceListImpl < T > ( Self : List < T > ; from , step , count : integer ) : List < T ></i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SliceArrayImpl<T>(Self: array of T">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SliceArrayImpl<T>(Self: array of T; from,step,count: integer): array of T;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SliceArrayImpl < T > ( Self : array of T ; from , step , count : integer ) : array of T</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SliceStringImpl(Self: string">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SliceStringImpl(Self: string; from,step,count: integer): string;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SliceStringImpl ( Self : string ; from , step , count : integer ) : string</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceListImpl">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SystemSliceListImpl<T>(Self: List<T>; situation: integer; from,&to: integer; step: integer := 1): List<T>;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceListImpl < T > ( Self : List < T > ; situation : integer ; from , &to : integer ; step : integer : = 1 ) : List < T ></i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceArrayImpl">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SystemSliceArrayImpl<T>(Self: array of T; situation: integer; from,&to: integer; step: integer := 1): array of T;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceArrayImpl < T > ( Self : array of T ; situation : integer ; from , &to : integer ; step : integer : = 1 ) : array of T</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceStringImpl">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SystemSliceStringImpl(Self: string; situation: integer; from,&to: integer; step: integer := 1): string;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceStringImpl ( Self : string ; situation : integer ; from , &to : integer ; step : integer : = 1 ) : string</i>
|
||||
<i Type="Method">function CreateSliceFromListInternal < T > ( Self : List < T > ; from , step , count : integer ) : List < T ></i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
|
|
@ -2458,11 +2367,233 @@
|
|||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function CreateSliceFromStringInternal<T>(Self: string; from,count,step: integer): string;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function CreateSliceFromStringInternal ( Self : string ; from , count , step : integer ) : string</i>
|
||||
<i Type="Method">function CreateSliceFromStringInternal ( Self : string ; from , step , count : integer ) : string</i>
|
||||
<i Type="Method">function Low ( self : System . Array ) extensionmethod : = Low ( Self )</i>
|
||||
<i Type="Method">function High ( self : System . Array ) extensionmethod : = High ( Self )</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="Slice">
|
||||
<Items>
|
||||
<Node Name="SliceListImpl<T>(Self: List<T>">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SliceListImpl<T>(Self: List<T>; from,step,count: integer): List<T>;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SliceListImpl < T > ( Self : List < T > ; from , step , count : integer ) : List < T ></i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SliceArrayImpl<T>(Self: array of T">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SliceArrayImpl<T>(Self: array of T; from,step,count: integer): array of T;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SliceArrayImpl < T > ( Self : array of T ; from , step , count : integer ) : array of T</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SliceStringImpl(Self: string">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SliceStringImpl(Self: string; from,step,count: integer): string;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SliceStringImpl ( Self : string ; from , step , count : integer ) : string</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="Slice<T>(Self: sequence of T">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function Slice<T>(Self: sequence of T; from,step: integer): sequence of T; extensionmethod;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function Slice < T > ( Self : sequence of T ; from , step : integer ) : sequence of T extensionmethod</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="Slice<T>(Self: List<T>">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function Slice<T>(Self: List<T>; from,step,count: integer): List<T>; extensionmethod;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function Slice < T > ( Self : List < T > ; from , step , count : integer ) : List < T > extensionmethod</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="Slice<T>(Self: array of T">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function Slice<T>(Self: array of T; from,step: integer): array of T; extensionmethod;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function Slice < T > ( Self : array of T ; from , step : integer ) : array of T extensionmethod</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="Slice(Self: string;">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function Slice(Self: string; from,step: integer): string; extensionmethod;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function Slice ( Self : string ; from , step : integer ) : string extensionmethod</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
</Items>
|
||||
</Node>
|
||||
<Node Name="SystemSlice">
|
||||
<Items>
|
||||
<Node Name="CalcCountForSystemSlice">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function CalcCountForSystemSlice(situation: integer; Len: integer; var from,&to: integer; step: integer): integer;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function CheckAndCorrectFromToAndCalcCountForSystemSlice ( situation : integer ; Len : integer ; var from , &to : integer ; step : integer ) : integer</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceListImpl">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SystemSliceListImpl<T>(Self: List<T>; situation: integer; from,&to: integer; step: integer := 1): List<T>;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceListImpl < T > ( Self : List < T > ; situation : integer ; from , &to : integer ; step : integer : = 1 ) : List < T ></i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceArrayImpl">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SystemSliceArrayImpl<T>(Self: array of T; situation: integer; from,&to: integer; step: integer := 1): array of T;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceArrayImpl < T > ( Self : array of T ; situation : integer ; from , &to : integer ; step : integer : = 1 ) : array of T</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceStringImpl">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function SystemSliceStringImpl(Self: string; situation: integer; from,&to: integer; step: integer := 1): string;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceStringImpl ( Self : string ; situation : integer ; from , &to : integer ; step : integer : = 1 ) : string</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSlice<T>(Self: List<T>">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSlice < T > ( Self : List < T > ; situation : integer ; from , &to : integer ) : List < T > extensionmethod</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSlice<T>(Self: array of T">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSlice < T > ( Self : array of T ; situation : integer ; from , &to : integer ) : array of T extensionmethod</i>
|
||||
<i Type="Method">function Low ( self : System . Array ) extensionmethod : = Low ( Self )</i>
|
||||
<i Type="Method">function High ( self : System . Array ) extensionmethod : = High ( Self )</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSlice(Self: string">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSlice ( Self : string ; situation : integer ; from , &to : integer ) : string extensionmethod</i>
|
||||
<i Type="Method">function Low ( self : System . Array ) extensionmethod : = Low ( Self )</i>
|
||||
<i Type="Method">function High ( self : System . Array ) extensionmethod : = High ( Self )</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
</Items>
|
||||
</Node>
|
||||
<Node Name="SystemSliceQuestion">
|
||||
<Items>
|
||||
<Node Name="CheckStepAndCorrectFromTo">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">procedure CheckStepAndCorrectFromTo ( situation : integer ; Len : integer ; var from , &to : integer ; step : integer )</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceListImplQuestion">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceListImplQuestion < T > ( Self : List < T > ; situation : integer ; from , &to : integer ; step : integer : = 1 ) : List < T ></i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceQuestion<T>(Self: List<T>">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceQuestion < T > ( Self : List < T > ; situation : integer ; from , &to : integer ) : List < T > extensionmethod</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceArrayImplQuestion">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceArrayImplQuestion < T > ( Self : array of T ; situation : integer ; from , &to : integer ; step : integer : = 1 ) : array of T</i>
|
||||
<i Type="Method">function Low ( self : System . Array ) extensionmethod : = Low ( Self )</i>
|
||||
<i Type="Method">function High ( self : System . Array ) extensionmethod : = High ( Self )</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceQuestion<T>(Self: array of T">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceQuestion < T > ( Self : array of T ; situation : integer ; from , &to : integer ) : array of T extensionmethod</i>
|
||||
<i Type="Method">function Low ( self : System . Array ) extensionmethod : = Low ( Self )</i>
|
||||
<i Type="Method">function High ( self : System . Array ) extensionmethod : = High ( Self )</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceStringImplQuestion">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceStringImplQuestion ( Self : string ; situation : integer ; from , &to : integer ; step : integer : = 1 ) : string</i>
|
||||
<i Type="Method">function Low ( self : System . Array ) extensionmethod : = Low ( Self )</i>
|
||||
<i Type="Method">function High ( self : System . Array ) extensionmethod : = High ( Self )</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="SystemSliceQuestion(Self: string">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">function SystemSliceQuestion ( Self : string ; situation : integer ; from , &to : integer ) : string extensionmethod</i>
|
||||
<i Type="Method">function Low ( self : System . Array ) extensionmethod : = Low ( Self )</i>
|
||||
<i Type="Method">function High ( self : System . Array ) extensionmethod : = High ( Self )</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="CorrectFromTo">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<OCtx>
|
||||
<i Type="Method">procedure CorrectFromTo ( situation : integer ; Len : integer ; var from , &to : integer ; step : integer )</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
<Node Name="CorrectFromToAndCalcCountForSystemSliceQuestion">
|
||||
<FileName>\PABCSystem.pas</FileName>
|
||||
<Text>function CorrectFromToAndCalcCountForSystemSliceQuestion(situation: integer; Len: integer; var from,&to: integer; step: integer): integer;</Text>
|
||||
<OCtx>
|
||||
<i Type="Method">function CorrectFromToAndCalcCountForSystemSliceQuestion ( situation : integer ; Len : integer ; var from , &to : integer ; step : integer ) : integer</i>
|
||||
<i Type="PAS_TreeNode">
|
||||
</i>
|
||||
</OCtx>
|
||||
</Node>
|
||||
</Items>
|
||||
</Node>
|
||||
</Items>
|
||||
</Node>
|
||||
<Node Name="read_lexem">
|
||||
|
|
|
|||
|
|
@ -216,10 +216,10 @@ type
|
|||
Predicate<T> = System.Predicate<T>;
|
||||
|
||||
/// Представляет функцию с двумя параметрами, возвращающую boolean
|
||||
Predicate2<T1,T2> = System.Predicate<T1,T2>;
|
||||
Predicate2<T1,T2> = function(x1: T1; x2: T2): boolean;
|
||||
|
||||
/// Представляет функцию с тремя параметрами, возвращающую boolean
|
||||
Predicate3<T1,T2,T3> = System.Predicate<T1,T2,T3>;
|
||||
Predicate3<T1,T2,T3> = function(x1: T1; x2: T2; x3: T3): boolean;
|
||||
|
||||
/// Представляет регулярное выражение
|
||||
Regex = System.Text.RegularExpressions.Regex;
|
||||
|
|
@ -8603,8 +8603,64 @@ begin
|
|||
Result := Self;
|
||||
end;
|
||||
|
||||
procedure CorrectFromTo(situation: integer; Len: integer; var from,&to: integer; step: integer);
|
||||
begin
|
||||
if step>0 then
|
||||
begin
|
||||
case situation of
|
||||
1: from := 0;
|
||||
2: &to := Len;
|
||||
3: begin
|
||||
from := 0;
|
||||
&to := Len;
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
case situation of
|
||||
1: from := Len - 1;
|
||||
2: &to := -1;
|
||||
3: begin
|
||||
from := Len - 1;
|
||||
&to := -1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
///--
|
||||
function CalcCountForSystemSlice(situation: integer; Len: integer; var from,&to: integer; step: integer): integer;
|
||||
function CorrectFromToAndCalcCountForSystemSliceQuestion(situation: integer; Len: integer; var from,&to: integer; step: integer): integer;
|
||||
begin
|
||||
if step = 0 then
|
||||
raise new ArgumentException(GetTranslation(PARAMETER_STEP_MUST_BE_NOT_EQUAL_0));
|
||||
|
||||
CorrectFromTo(situation,Len,from,&to,step);
|
||||
|
||||
if step>0 then
|
||||
begin
|
||||
if from<0 then
|
||||
from += (step - from - 1) div step * step;
|
||||
// from может оказаться > Len - 1
|
||||
var m := min(Len,&to);
|
||||
if from >= m then
|
||||
Result := 0
|
||||
else Result := (m - from - 1) div step + 1
|
||||
end
|
||||
else
|
||||
begin
|
||||
if from > Len - 1 then
|
||||
from -= (from - Len - step) div step * step;
|
||||
// from может оказаться < 0
|
||||
var m := max(&to,-1);
|
||||
if from <= m then
|
||||
Result := 0
|
||||
else Result := (from - m - 1) div (-step) + 1
|
||||
end;
|
||||
end;
|
||||
|
||||
///--
|
||||
function CheckAndCorrectFromToAndCalcCountForSystemSlice(situation: integer; Len: integer; var from,&to: integer; step: integer): integer;
|
||||
begin
|
||||
// situation = 0 - все параметры присутствуют
|
||||
// situation = 1 - from отсутствует
|
||||
|
|
@ -8621,19 +8677,12 @@ begin
|
|||
if (&to < -1) or (&to > Len) then
|
||||
raise new ArgumentException(GetTranslation(PARAMETER_TO_OUT_OF_RANGE));
|
||||
|
||||
CorrectFromTo(situation,Len,from,&to,step);
|
||||
|
||||
var count: integer;
|
||||
|
||||
if step>0 then
|
||||
begin
|
||||
case situation of
|
||||
1: from := 0;
|
||||
2: &to := Len;
|
||||
3: begin
|
||||
from := 0;
|
||||
&to := Len;
|
||||
end;
|
||||
end;
|
||||
|
||||
var cnt := &to - from;
|
||||
if cnt<=0 then
|
||||
count := 0
|
||||
|
|
@ -8641,27 +8690,40 @@ begin
|
|||
end
|
||||
else
|
||||
begin
|
||||
case situation of
|
||||
1: from := Len - 1;
|
||||
2: &to := -1;
|
||||
3: begin
|
||||
from := Len - 1;
|
||||
&to := -1;
|
||||
end;
|
||||
end;
|
||||
|
||||
var cnt := from - &to;
|
||||
if cnt<=0 then
|
||||
count := 0
|
||||
else count := (cnt-1) div (-step) + 1;
|
||||
end;
|
||||
|
||||
Result := count;
|
||||
end;
|
||||
|
||||
///--
|
||||
procedure CheckStepAndCorrectFromTo(situation: integer; Len: integer; var from,&to: integer; step: integer);
|
||||
begin
|
||||
// situation = 0 - все параметры присутствуют
|
||||
// situation = 1 - from отсутствует
|
||||
// situation = 2 - to отсутствует
|
||||
// situation = 3 - from и to отсутствуют
|
||||
if step = 0 then
|
||||
raise new ArgumentException(GetTranslation(PARAMETER_STEP_MUST_BE_NOT_EQUAL_0));
|
||||
|
||||
{if (situation=0) or (situation=2) then
|
||||
if (from < 0) or (from > Len - 1) then
|
||||
raise new ArgumentException(GetTranslation(PARAMETER_FROM_OUT_OF_RANGE));
|
||||
|
||||
if (situation=0) or (situation=1) then
|
||||
if (&to < -1) or (&to > Len) then
|
||||
raise new ArgumentException(GetTranslation(PARAMETER_TO_OUT_OF_RANGE));}
|
||||
|
||||
CorrectFromTo(situation,Len,from,&to,step);
|
||||
end;
|
||||
|
||||
///--
|
||||
function SystemSliceListImpl<T>(Self: List<T>; situation: integer; from,&to: integer; step: integer := 1): List<T>;
|
||||
begin
|
||||
var count := CalcCountForSystemSlice(situation,Self.Count,from,&to,step);
|
||||
var count := CheckAndCorrectFromToAndCalcCountForSystemSlice(situation,Self.Count,from,&to,step);
|
||||
|
||||
Result := CreateSliceFromListInternal(Self,from,step,count);
|
||||
end;
|
||||
|
|
@ -8678,6 +8740,25 @@ begin
|
|||
Result := SystemSliceListImpl(Self,situation,from,&to,step);
|
||||
end;
|
||||
|
||||
///--
|
||||
function SystemSliceListImplQuestion<T>(Self: List<T>; situation: integer; from,&to: integer; step: integer := 1): List<T>;
|
||||
begin
|
||||
var count := CorrectFromToAndCalcCountForSystemSliceQuestion(situation,Self.Count,from,&to,step);
|
||||
|
||||
Result := CreateSliceFromListInternal(Self,from,step,count);
|
||||
end;
|
||||
|
||||
///--
|
||||
function SystemSliceQuestion<T>(Self: List<T>; situation: integer; from,&to: integer): List<T>; extensionmethod;
|
||||
begin
|
||||
Result := SystemSliceListImplQuestion(Self,situation,from,&to,1);
|
||||
end;
|
||||
|
||||
///--
|
||||
function SystemSliceQuestion<T>(Self: List<T>; situation: integer; from,&to,step: integer): List<T>; extensionmethod;
|
||||
begin
|
||||
Result := SystemSliceListImplQuestion(Self,situation,from,&to,step);
|
||||
end;
|
||||
// -----------------------------------------------------
|
||||
//>> Методы расширения типа array [,] of T # Extension methods for array [,] of T
|
||||
// -----------------------------------------------------
|
||||
|
|
@ -9220,7 +9301,7 @@ end;
|
|||
///--
|
||||
function SystemSliceArrayImpl<T>(Self: array of T; situation: integer; from,&to: integer; step: integer := 1): array of T;
|
||||
begin
|
||||
var count := CalcCountForSystemSlice(situation,Self.Length,from,&to,step);
|
||||
var count := CheckAndCorrectFromToAndCalcCountForSystemSlice(situation,Self.Length,from,&to,step);
|
||||
|
||||
Result := CreateSliceFromArrayInternal(Self,from,step,count)
|
||||
end;
|
||||
|
|
@ -9237,6 +9318,26 @@ begin
|
|||
Result := SystemSliceArrayImpl(Self,situation,from,&to,step);
|
||||
end;
|
||||
|
||||
///--
|
||||
function SystemSliceArrayImplQuestion<T>(Self: array of T; situation: integer; from,&to: integer; step: integer := 1): array of T;
|
||||
begin
|
||||
var count := CorrectFromToAndCalcCountForSystemSliceQuestion(situation,Self.Length,from,&to,step);
|
||||
|
||||
Result := CreateSliceFromArrayInternal(Self,from,step,count);
|
||||
end;
|
||||
|
||||
///--
|
||||
function SystemSliceQuestion<T>(Self: array of T; situation: integer; from,&to: integer): array of T; extensionmethod;
|
||||
begin
|
||||
Result := SystemSliceArrayImplQuestion(Self,situation,from,&to,1);
|
||||
end;
|
||||
|
||||
///--
|
||||
function SystemSliceQuestion<T>(Self: array of T; situation: integer; from,&to,step: integer): array of T; extensionmethod;
|
||||
begin
|
||||
Result := SystemSliceArrayImplQuestion(Self,situation,from,&to,step);
|
||||
end;
|
||||
|
||||
// -----------------------------------------------------
|
||||
//>> Методы расширения типа integer # Extension methods for integer
|
||||
// -----------------------------------------------------
|
||||
|
|
@ -9588,7 +9689,7 @@ function SystemSliceStringImpl(Self: string; situation: integer; from,&to: integ
|
|||
begin
|
||||
var fromv := from-1;
|
||||
var tov := &to-1;
|
||||
var count := CalcCountForSystemSlice(situation,Self.Length,fromv,tov,step);
|
||||
var count := CheckAndCorrectFromToAndCalcCountForSystemSlice(situation,Self.Length,fromv,tov,step);
|
||||
|
||||
Result := CreateSliceFromStringInternal(Self,fromv+1,step,count)
|
||||
end;
|
||||
|
|
@ -9605,7 +9706,28 @@ begin
|
|||
Result := SystemSliceStringImpl(Self,situation,from,&to,step);
|
||||
end;
|
||||
|
||||
///--
|
||||
function SystemSliceStringImplQuestion(Self: string; situation: integer; from,&to: integer; step: integer := 1): string;
|
||||
begin
|
||||
var fromv := from-1;
|
||||
var tov := &to-1;
|
||||
|
||||
var count := CorrectFromToAndCalcCountForSystemSliceQuestion(situation,Self.Length,fromv,tov,step);
|
||||
|
||||
Result := CreateSliceFromStringInternal(Self,fromv+1,step,count);
|
||||
end;
|
||||
|
||||
///--
|
||||
function SystemSliceQuestion(Self: string; situation: integer; from,&to: integer): string; extensionmethod;
|
||||
begin
|
||||
Result := SystemSliceStringImplQuestion(Self,situation,from,&to,1);
|
||||
end;
|
||||
|
||||
///--
|
||||
function SystemSliceQuestion(Self: string; situation: integer; from,&to,step: integer): string; extensionmethod;
|
||||
begin
|
||||
Result := SystemSliceStringImplQuestion(Self,situation,from,&to,step);
|
||||
end;
|
||||
//--------------------------------------------
|
||||
//>> Методы расширения типа Func # Extension methods for Func
|
||||
//--------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue