From f5cb7bc816ebe743322b757afc679f13b081ba09 Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Sat, 8 Dec 2018 11:41:26 +0300 Subject: [PATCH] bug fix #1053 --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 4 ++-- Localization/DefaultLang.resources | Bin 88404 -> 88482 bytes .../PascalABCParserNewSaushkin/ABCPascal.cs | 2 +- .../PascalABCParserNewSaushkin/ABCPascal.y | 9 ++++++- .../ABCPascalYacc.cs | 22 +++++++++++++++--- Parsers/PascalABCParserNewSaushkin/PABC.ymc | 1 + .../SemanticRules.cs | 4 ++-- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- TestSuite/errors/err0302.pas | 12 ++++++++++ bin/Lng/Eng/PascalABCParser.dat | 3 ++- bin/Lng/Rus/PascalABCParser.dat | 3 ++- 12 files changed, 51 insertions(+), 13 deletions(-) create mode 100644 TestSuite/errors/err0302.pas diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 82ae9e46c..2604838ad 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "4"; public const string Build = "2"; - public const string Revision = "1889"; + public const string Revision = "1890"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index 9020e7f9f..abe919bfe 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%COREVERSION%=2 -%REVISION%=1889 %MINOR%=4 +%REVISION%=1890 +%COREVERSION%=2 %MAJOR%=3 diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index 1721487fd1cd934ab906644972870b55e98d0908..bdc5da498a12589997b186f476f9b043e3cea5de 100644 GIT binary patch delta 100 zcmcbziFMIt)(H<7_icQr=j`L>8XV&45+CI1>>uP3@8as_>E{{Z>F*aD?-=A7@8%!m zSufC^}AwG7at$Ieeqx6`2!&9=}Qp(;pxw(Z+|!Qx@_llVRRP- E01{R-5dZ)H delta 31 ncmZ3qnf1yh)(H<73pPH~bDrGbA~so^MX // GPLEX frame file diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y index 34ddc34f1..58f9b0a59 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y @@ -1571,7 +1571,14 @@ object_type record_type : tkRecord optional_base_classes optional_where_section member_list_section tkEnd { - $$ = NewRecordType($2 as named_type_reference_list, $3 as where_definition_list, $4 as class_body_list, @$); + var nnrt = new class_definition($2 as named_type_reference_list, $4 as class_body_list, class_keyword.Record, null, $3 as where_definition_list, class_attribute.None, false, @$); + if (/*nnrt.body!=null && nnrt.body.class_def_blocks!=null && + nnrt.body.class_def_blocks.Count>0 &&*/ + nnrt.body.class_def_blocks[0].access_mod==null) + { + nnrt.body.class_def_blocks[0].access_mod = new access_modifer_node(access_modifer.public_modifer); + } + $$ = nnrt; } ; diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs index 12f378c6b..07d094f80 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs @@ -2,7 +2,7 @@ // GPPG version 1.3.6 // Machine: DESKTOP-G8V08V4 -// DateTime: 06.12.2018 14:23:43 +// DateTime: 08.12.2018 10:42:33 // UserName: ????????? // Input file @@ -3819,12 +3819,28 @@ public partial class GPPGParser: ShiftReduceParser(); + if (tt.Count()>0) + { + var sc = tt.First().source_context; + parsertools.AddErrorFromResource("NESTED_RECORD_DEFINITIONS_ARE_FORBIDDEN", new LexLocation(sc.begin_position.line_num, sc.begin_position.column_num-1, sc.end_position.line_num, sc.end_position.column_num, sc.FileName)); + } + + + + } break; case 286: // record_type -> tkRecord, optional_base_classes, optional_where_section, // member_list_section, tkEnd { - CurrentSemanticValue.td = NewRecordType(ValueStack[ValueStack.Depth-4].stn as named_type_reference_list, ValueStack[ValueStack.Depth-3].stn as where_definition_list, ValueStack[ValueStack.Depth-2].stn as class_body_list, CurrentLocationSpan); + var nnrt = new class_definition(ValueStack[ValueStack.Depth-4].stn as named_type_reference_list, ValueStack[ValueStack.Depth-2].stn as class_body_list, class_keyword.Record, null, ValueStack[ValueStack.Depth-3].stn as where_definition_list, class_attribute.None, false, CurrentLocationSpan); + if (/*nnrt.body!=null && nnrt.body.class_def_blocks!=null && + nnrt.body.class_def_blocks.Count>0 &&*/ + nnrt.body.class_def_blocks[0].access_mod==null) + { + nnrt.body.class_def_blocks[0].access_mod = new access_modifer_node(access_modifer.public_modifer); + } + CurrentSemanticValue.td = nnrt; } break; case 287: // class_attribute -> tkSealed diff --git a/Parsers/PascalABCParserNewSaushkin/PABC.ymc b/Parsers/PascalABCParserNewSaushkin/PABC.ymc index 573550eb9..729c94a08 100644 --- a/Parsers/PascalABCParserNewSaushkin/PABC.ymc +++ b/Parsers/PascalABCParserNewSaushkin/PABC.ymc @@ -237,5 +237,6 @@ script= + diff --git a/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs b/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs index f175e7be5..de333a246 100644 --- a/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs +++ b/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs @@ -138,7 +138,7 @@ namespace GPPGParserScanner return nnof; } - public class_definition NewRecordType(named_type_reference_list opt_base_classes, where_definition_list opt_where_section, class_body_list component_list_seq, LexLocation loc) + /*public class_definition NewRecordType(named_type_reference_list opt_base_classes, where_definition_list opt_where_section, class_body_list component_list_seq, LexLocation loc) { var nnrt = new class_definition(opt_base_classes, component_list_seq, class_keyword.Record, null, opt_where_section, class_attribute.None, false, loc); if (nnrt.body!=null && nnrt.body.class_def_blocks!=null && @@ -147,7 +147,7 @@ namespace GPPGParserScanner nnrt.body.class_def_blocks[0].access_mod = new access_modifer_node(access_modifer.public_modifer); } return nnrt; - } + } */ public token_info NewClassOrInterfaceKeyword(token_info tktemp) { diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 15621391d..70bd25bbd 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.4.2.1889' +!define VERSION '3.4.2.1890' diff --git a/TestSuite/errors/err0302.pas b/TestSuite/errors/err0302.pas new file mode 100644 index 000000000..af7515968 --- /dev/null +++ b/TestSuite/errors/err0302.pas @@ -0,0 +1,12 @@ +var y: real; + +type + A = class + fX: record + x: integer; + end; + end; + end; + +begin +end. \ No newline at end of file diff --git a/bin/Lng/Eng/PascalABCParser.dat b/bin/Lng/Eng/PascalABCParser.dat index e9f943d25..7ad73c1ff 100644 --- a/bin/Lng/Eng/PascalABCParser.dat +++ b/bin/Lng/Eng/PascalABCParser.dat @@ -70,4 +70,5 @@ INVALID_INTERFACE_MEMBER=Interface members cannot have definitions EXTENDED_INDEXED_PROPERTIES=Extended indexed properties are not realized ATTRIBUTE_REDECLARED=This attribute has been already applied to type STATIC_PROPERTIES_CANNOT_HAVE_ATTRBUTE_{0}=Static properties cannot have attribute '{0}' -RESULT_IDENT_NOT_EXPECTED_IN_THIS_CONTEXT=Result identifier is not allowed in this context \ No newline at end of file +RESULT_IDENT_NOT_EXPECTED_IN_THIS_CONTEXT=Result identifier is not allowed in this context +NESTED_RECORD_DEFINITIONS_ARE_FORBIDDEN=Nested record definitions are forbidden \ No newline at end of file diff --git a/bin/Lng/Rus/PascalABCParser.dat b/bin/Lng/Rus/PascalABCParser.dat index ae1f331b2..1adcb05a8 100644 --- a/bin/Lng/Rus/PascalABCParser.dat +++ b/bin/Lng/Rus/PascalABCParser.dat @@ -71,4 +71,5 @@ EXTENDED_INDEXED_PROPERTIES=Индексные свойства не могут TWO_STRING_LITERALS_IN_SUCCESSION=Две литеральные строковые константы не могут стоять подряд ATTRIBUTE_REDECLARED=Повторное применение атрибута STATIC_PROPERTIES_CANNOT_HAVE_ATTRBUTE_{0}=Статические свойства не могут иметь атрибут '{0}' -RESULT_IDENT_NOT_EXPECTED_IN_THIS_CONTEXT=Имя Result недопустимо в этом контексте \ No newline at end of file +RESULT_IDENT_NOT_EXPECTED_IN_THIS_CONTEXT=Имя Result недопустимо в этом контексте +NESTED_RECORD_DEFINITIONS_ARE_FORBIDDEN=Вложенные описания записей запрещены \ No newline at end of file