This commit is contained in:
Ivan Bondarev 2022-04-15 15:04:36 +02:00
parent 7a48484a41
commit 577ae41cac
9 changed files with 42 additions and 18 deletions

View file

@ -579,16 +579,24 @@ namespace CodeFormatters
comm = "() ->";
comm += " ";
}
else if (comm.EndsWith("procedure->("))
{
comm = comm.Replace("procedure->(", "procedure -> (");
}
else if (comm.EndsWith("procedure->"))
{
comm = comm.Replace("procedure->", "procedure -> ");
}
else if (comm.StartsWith(":") && comm.EndsWith(":") && comm.Replace(" ", "") == "::")
comm = "::";
else if (comm.StartsWith("[") && comm.EndsWith(":"))
comm = comm.Replace(" ", "");
else if (comm.StartsWith("( ") && comm.TrimEnd().EndsWith("var"))
comm = comm.Replace(" ", "")+" ";
comm = comm.Replace(" ", "") + " ";
else if (trimed_comm.StartsWith(", ") && comm.TrimEnd().EndsWith("var"))
comm = RemoveOverSpaces(comm);
else if (trimed_comm.StartsWith(",var"))
comm = ", var"+ trimed_comm.Replace(",var", "");
comm = ", var" + trimed_comm.Replace(",var", "");
else if (comm.StartsWith("array") || comm.StartsWith("set") || comm.StartsWith("sequence"))
comm = RemoveOverSpaces(comm);
else if ((comm.StartsWith("class") || comm.StartsWith("interface")) && comm.EndsWith("("))

View file

@ -1,9 +1,9 @@
//
// This CSharp output file generated by Gardens Point LEX
// Version: 1.1.3.301
// Machine: DESKTOP-G8V08V4
// DateTime: 23.02.2022 10:29:10
// UserName: ?????????
// Machine: DESKTOP-2BJCJ7I
// DateTime: 15.04.2022 12:29:57
// UserName: ibond
// GPLEX input file <ABCPascal.lex>
// GPLEX frame file <embedded resource>
//

View file

@ -5185,7 +5185,7 @@ common_lambda_body
}
| tkRoundOpen assignment tkRoundClose
{
$$ = new statement_list($2 as statement, @$);
$$ = new statement_list($2 as statement, @2);
}
;

View file

@ -1,10 +1,10 @@
// (see accompanying GPPGcopyright.rtf)
// GPPG version 1.3.6
// Machine: DESKTOP-G8V08V4
// DateTime: 23.02.2022 10:29:11
// UserName: ?????????
// Input file <D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y>
// Machine: DESKTOP-2BJCJ7I
// DateTime: 15.04.2022 12:29:58
// UserName: ibond
// Input file <ABCPascal.y>
// options: no-lines gplex
@ -60,7 +60,7 @@ public abstract class ScanBase : AbstractScanner<PascalABCSavParser.Union,LexLoc
public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, LexLocation>
{
// Verbatim content from D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y
// Verbatim content from ABCPascal.y
// <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> GPPGParser, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> gppg
public syntax_tree_node root; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -72,7 +72,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
public ParserLambdaHelper lambdaHelper = new ParserLambdaHelper();
public GPPGParser(AbstractScanner<PascalABCSavParser.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;
@ -7767,7 +7767,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 1006: // common_lambda_body -> tkRoundOpen, assignment, tkRoundClose
{
CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-2].stn as statement, CurrentLocationSpan);
CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-2].stn as statement, LocationStack[LocationStack.Depth-2]);
}
break;
case 1007: // lambda_function_body -> expr_l1_for_lambda

View file

@ -1,8 +1,8 @@
procedure p<X,Y>(a: System.Func<X, Y>; b:System.Func<Y, X>; c: X);
procedure p<X,Y>(a: System.Func<X, Y>; b:System.Func<Y, X>; c: X);
begin
writeln(a(c));
end;
begin
p(x -> x, x -> 1.0, 4.0);
end.
p(x->x,x->1.0,4.0);
end.

View file

@ -1,4 +1,4 @@
uses System, System.Collections.Generic;
uses System, System.Collections.Generic;
procedure p<X, Y> (a: X; b: Action<IEnumerable<Dictionary<X, Y>>>; c: Y);
begin
@ -6,5 +6,5 @@ begin
end;
begin
p(4, procedure(x) -> begin end, 5);
p(4, procedure(x)->begin end, 5);
end.

View file

@ -0,0 +1,4 @@
begin
var v := 0;
var p := procedure->(v:=v);
end.

View file

@ -0,0 +1,8 @@
procedure p<X, Y>(a: System.Func<X, Y>; b: System.Func<Y, X>; c: X);
begin
writeln(a(c));
end;
begin
p(x -> x, x -> 1.0, 4.0);
end.

View file

@ -0,0 +1,4 @@
begin
var v := 0;
var p := procedure -> (v := v);
end.