diff --git a/Compiler/Compiler.cs b/Compiler/Compiler.cs index 64a37b3d7..900db570e 100644 --- a/Compiler/Compiler.cs +++ b/Compiler/Compiler.cs @@ -191,6 +191,15 @@ namespace PascalABCCompiler } } + public class NamespaceCannotHaveInSection : CompilerCompilationError + { + public NamespaceCannotHaveInSection(SyntaxTree.SourceContext sc) + : base(string.Format(StringResources.Get("COMPILATIONERROR_NAMESPACE_CANNOT_HAVE_IN_SECTION"))) + { + this.source_context = sc; + } + } + public class ProgramModuleExpected : CompilerCompilationError { public ProgramModuleExpected(string FileName, SyntaxTree.SourceContext sc) @@ -3112,6 +3121,12 @@ namespace PascalABCCompiler string UnitName = GetUnitFileName(SyntaxUsesUnit); //if (UnitName == null) throw new UnitNotFound(SyntaxUsesUnit.name, CompilationUnit CurrentUnit = UnitTable[UnitName]; + if (CurrentUnit != null && CurrentUnit.SemanticTree is PascalABCCompiler.TreeRealization.dot_net_unit_node + && SyntaxUsesUnit is PascalABCCompiler.SyntaxTree.uses_unit_in ui && ui.in_file != null) // значит, это пространство имен и секция in у него должна отсутствовать + { + ErrorsList.Add(new NamespaceCannotHaveInSection(ui.in_file.source_context)); + } + string name = Path.GetFileNameWithoutExtension(UnitName); if (Path.GetExtension(UnitName).ToLower() == CompilerOptions.CompiledUnitExtension) { diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 8654919e8..b5ab601d5 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 = "5"; public const string Build = "0"; - public const string Revision = "2197"; + public const string Revision = "2199"; 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 3d9f9c8b5..990b48504 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %MINOR%=5 -%REVISION%=2197 +%REVISION%=2199 %COREVERSION%=0 %MAJOR%=3 diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index 8a14dfa1b..a2a6aab25 100644 Binary files a/Localization/DefaultLang.resources and b/Localization/DefaultLang.resources differ diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs index 4c5eef97c..8e9b9a8fc 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs @@ -2,7 +2,7 @@ // This CSharp output file generated by Gardens Point LEX // Version: 1.1.3.301 // Machine: DESKTOP-G8V08V4 -// DateTime: 11.07.2019 16:30:18 +// DateTime: 14.07.2019 10:48:31 // UserName: ????????? // GPLEX input file // GPLEX frame file diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y index 877996de5..06d1b8671 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y @@ -360,6 +360,8 @@ used_unit_name } | ident_or_keyword_pointseparator_list tkIn tkStringLiteral { + if ($3 is char_const _cc) + $3 = new string_const(_cc.cconst.ToString()); $$ = new uses_unit_in($1 as ident_list, $3 as string_const, @$); } ; diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs index 225deeae5..3432c1875 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs @@ -2,7 +2,7 @@ // GPPG version 1.3.6 // Machine: DESKTOP-G8V08V4 -// DateTime: 11.07.2019 16:30:18 +// DateTime: 14.07.2019 10:48:31 // UserName: ????????? // Input file @@ -2838,6 +2838,8 @@ public partial class GPPGParser: ShiftReduceParser ident_or_keyword_pointseparator_list, tkIn, tkStringLiteral { + if (ValueStack[ValueStack.Depth-1].stn is char_const _cc) + ValueStack[ValueStack.Depth-1].stn = new string_const(_cc.cconst.ToString()); CurrentSemanticValue.stn = new uses_unit_in(ValueStack[ValueStack.Depth-3].stn as ident_list, ValueStack[ValueStack.Depth-1].stn as string_const, CurrentLocationSpan); } break; diff --git a/Parsers/PascalABCParserNewSaushkin/PABC.ymc b/Parsers/PascalABCParserNewSaushkin/PABC.ymc index 1e16e7db1..4ed88c0a9 100644 --- a/Parsers/PascalABCParserNewSaushkin/PABC.ymc +++ b/Parsers/PascalABCParserNewSaushkin/PABC.ymc @@ -247,5 +247,6 @@ script= + diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index a848ec305..9d71b75b6 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.5.0.2197' +!define VERSION '3.5.0.2199' diff --git a/TestSuite/errors/err0333.pas b/TestSuite/errors/err0333.pas new file mode 100644 index 000000000..1d01b6535 --- /dev/null +++ b/TestSuite/errors/err0333.pas @@ -0,0 +1,5 @@ +uses System in 'abc'; + +begin + p; +end. \ No newline at end of file diff --git a/VisualPascalABCNET/AutoInsertCode/AutoInsertCode.cs b/VisualPascalABCNET/AutoInsertCode/AutoInsertCode.cs index d06bb8d12..4d46b32db 100644 --- a/VisualPascalABCNET/AutoInsertCode/AutoInsertCode.cs +++ b/VisualPascalABCNET/AutoInsertCode/AutoInsertCode.cs @@ -115,7 +115,7 @@ namespace VisualPascalABC // Проанализируем предыдущий оператор по первому слову var pst = prev?.TrimStart().ToLower(); if (pst != null) - if (pst.StartsWith("if") || pst.StartsWith("for") || pst.StartsWith("loop") || pst.StartsWith("with") || pst.StartsWith("on") || pst.StartsWith("while") || pst.StartsWith("else")) // потом улучшу - для нескольких выборов + if (pst.StartsWith("if") || pst.StartsWith("for") || pst.StartsWith("loop") || pst.StartsWith("with") || pst.StartsWith("on") || pst.StartsWith("while") || pst.StartsWith("else") || pst.StartsWith("foreach")) // потом улучшу - для нескольких выборов { // Надо удалить в текущей строке пробелы чтобы выровнять begin по if var iprev = Indent(prev); diff --git a/bin/Lng/Eng/CompilerErrors.dat b/bin/Lng/Eng/CompilerErrors.dat index f5c4c766a..fa1f8734a 100644 --- a/bin/Lng/Eng/CompilerErrors.dat +++ b/bin/Lng/Eng/CompilerErrors.dat @@ -16,6 +16,7 @@ MAINRESOURCE_NOT_ALLOWED=mainresource can not be used with the directives: produ DUPLICATE_DIRECTIVE{0}=Duplicate directive {0} FILE_{0}_NOT_FOUND=File '{0}' not found NAMESPACE_CAN_BE_COMPILED_ONLY_IN_PROJECTS=Files with namespaces can be compiled only inside projects +NAMESPACE_CANNOT_HAVE_IN_SECTION=Namespace cannot have 'in' section %PREFIX%= COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Internal compiler error in module {0} :'{1}' \ No newline at end of file diff --git a/bin/Lng/Rus/CompilerErrors.dat b/bin/Lng/Rus/CompilerErrors.dat index 929acd45b..7ccf1186c 100644 --- a/bin/Lng/Rus/CompilerErrors.dat +++ b/bin/Lng/Rus/CompilerErrors.dat @@ -16,6 +16,7 @@ MAINRESOURCE_NOT_ALLOWED=Недопустимо совместное испол DUPLICATE_DIRECTIVE{0}=Повторное объявление директивы {0} NAMESPACE_CAN_BE_COMPILED_ONLY_IN_PROJECTS=Компиляция файлов с пространствами имен допустима только в проектах FILE_{0}_NOT_FOUND=Файл '{0}' не найден +NAMESPACE_CANNOT_HAVE_IN_SECTION=Для пространства имен не может указываться секция in %PREFIX%= COMPILER_INTERNAL_ERROR_IN_UNIT_{0}_:{1}=Внутренняя ошибка компилятора в модуле {0} :'{1}' \ No newline at end of file