fix #2028
This commit is contained in:
parent
b9c7d5deea
commit
32a5606ac0
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%MINOR%=5
|
||||
%REVISION%=2197
|
||||
%REVISION%=2199
|
||||
%COREVERSION%=0
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -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 <ABCPascal.lex>
|
||||
// GPLEX frame file <embedded resource>
|
||||
|
|
|
|||
|
|
@ -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, @$);
|
||||
}
|
||||
;
|
||||
|
|
|
|||
|
|
@ -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 <ABCPascal.y>
|
||||
|
||||
|
|
@ -2838,6 +2838,8 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
|
|||
break;
|
||||
case 41: // used_unit_name -> 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;
|
||||
|
|
|
|||
|
|
@ -247,5 +247,6 @@ script=
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.5.0.2197'
|
||||
!define VERSION '3.5.0.2199'
|
||||
|
|
|
|||
5
TestSuite/errors/err0333.pas
Normal file
5
TestSuite/errors/err0333.pas
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
uses System in 'abc';
|
||||
|
||||
begin
|
||||
p;
|
||||
end.
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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}'
|
||||
|
|
@ -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}'
|
||||
Loading…
Reference in a new issue