Skip to content

Commit

Permalink
Merge branch 'release/v1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Ovsiankin committed Dec 8, 2020
2 parents 7cc7963 + e1a9e1e commit 9673f28
Show file tree
Hide file tree
Showing 81 changed files with 5,921 additions and 482 deletions.
19 changes: 14 additions & 5 deletions Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@

<MSBuild Projects="$(Solution)" Targets="Clean" Properties="ReleaseNumber=$(ReleaseNumber);Configuration=$(Configuration);Platform=%(PlatformItem.MSBuildName)"/>

</Target>

<Target Name="Make">
</Target>
<Target Name="Make">
<MSBuild Projects="$(Solution)" Targets="restore;Build" Properties="ReleaseNumber=$(ReleaseNumber);Configuration=$(Configuration);Platform=%(PlatformItem.MSBuildName);"/>
</Target>

Expand Down Expand Up @@ -84,7 +83,17 @@
</BinaryFiles>
<AspFiles Include="$(MSBuildProjectDirectory)/src/ASPNETHandler/bin/$(Configuration)/net452/ASPNETHandler.dll"/>
</ItemGroup>


<ItemGroup>
<BuiltProjects Include="ScriptEngine.NativeApi" />
<BinaryFiles Include="$(MSBuildProjectDirectory)/src/%(BuiltProjects.Identity)/bin/$(Configuration)/net452/*.dll">
<Dest>$(TempFolder)/bin</Dest>
</BinaryFiles>
<BinaryFiles Include="$(MSBuildProjectDirectory)/src/%(BuiltProjects.Identity)/bin/x86/$(Configuration)/net452/*.dll">
<Dest>$(TempFolder)/bin32</Dest>
</BinaryFiles>
</ItemGroup>

<Copy SourceFiles="@(BinaryFiles)" DestinationFiles="@(BinaryFiles->'%(Dest)/%(Filename)%(Extension)')" />
<Copy SourceFiles="@(AspFiles)" DestinationFolder="%(BinaryFiles.Dest)"/>
<!-- Копирование скрипта запуска для opm -->
Expand Down Expand Up @@ -238,4 +247,4 @@

</Target>

</Project>
</Project>
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pipeline {
agent none

environment {
ReleaseNumber = '1.4.0'
ReleaseNumber = '1.5.0'
outputEnc = '65001'
}

Expand Down
3 changes: 2 additions & 1 deletion install/install.iss
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Name: "docs"; Description: "Документация по свойствам и
[Files]
Source: "{#ArtifactRoot}\{#Binaries}\oscript.exe"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\ScriptEngine.HostedScript.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\ScriptEngine.NativeApi.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\ScriptEngine.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\OneScript.DebugProtocol.dll"; DestDir: "{app}\bin"; Components: main
Source: "{#ArtifactRoot}\{#Binaries}\OneScript.DebugServices.dll"; DestDir: "{app}\bin"; Components: main
Expand Down Expand Up @@ -200,4 +201,4 @@ begin
end;
result := true;
end;
end;
207 changes: 139 additions & 68 deletions src/1Script.sln

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/OneScript.Language.Tests/LexerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ public void Word_Literals_Processed_Correctly()
[Fact]
public void Preprocessor_Lexem_ProcessedCorrectly()
{
string code = "#Если #КонецЕсли";
string code = @"#Если
#КонецЕсли";

var iterator = new SourceCodeIterator(code);
var wordParser = new PreprocessorDirectiveLexerState();
Expand Down
279 changes: 279 additions & 0 deletions src/OneScript.Language.Tests/PreprocessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,285 @@ public void PriorityOperators_WithParenthesis()

Assert.Equal(Token.EndOfText, lex.Token);
}

[Fact]
public void ParsingFirstNot()
{
var pp = new PreprocessingLexer();
pp.Define("Да");

var code = @"
#Если Не Да Тогда
F;
#КонецЕсли";

pp.Code = code;

var lex = pp.NextLexem();

Assert.Equal(Token.EndOfText, lex.Token);
}

[Fact]
public void PreprocessingLexer_Unclosed_ElseBlock()
{
var pp = new PreprocessingLexer();
pp.Define("Да");

var code = @"
#Если Да и Не Да Тогда
F;
#Иначе
G;
";

pp.Code = code;

Assert.Throws<SyntaxErrorException>(() => {while (pp.NextLexem().Token != Token.EndOfText);});
}

[Fact]
public void PreprocessingLexer_Endif_Without_If()
{
var pp = new PreprocessingLexer();
pp.Define("Да");

var code = @"
#КонецЕсли
H;
";

pp.Code = code;

Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
}

[Fact]
public void PreprocessingLexer_Extra_Endif()
{
var pp = new PreprocessingLexer();
pp.Define("Да");

var code = @"
#Если Да Тогда
F;
#КонецЕсли
#КонецЕсли
";

pp.Code = code;

Assert.Throws<SyntaxErrorException>(() => {while (pp.NextLexem().Token != Token.EndOfText);});
}

[Fact]
public void PreprocessingLexer_SimpleRegion()
{
var pp = new PreprocessingLexer();

var code = @"
#Область reg1
#КонецОбласти
F";

pp.Code = code;
var lex = pp.NextLexem();
Assert.Equal("F", lex.Content);
}

[Fact]
public void PreprocessingLexer_MultipleNestedRegions()
{
var pp = new PreprocessingLexer();

var code = @"
#Region reg1
#Область reg2
#Область if // keywords are ok
#endRegion
#КонецОбласти // reg 1
#endRegion
# Область reg1 // same name is ok
#КонецОбласти
F";

pp.Code = code;
var lex = pp.NextLexem();
Assert.Equal("F", lex.Content);
}


[Fact]
public void PreprocessingLexer_NoEndRegion()
{
var pp = new PreprocessingLexer();

var code = @"
#Область reg1
#Область reg2
#КонецОбласти
F";

pp.Code = code;
Assert.Throws<SyntaxErrorException>(() => { while (pp.NextLexem().Token != Token.EndOfText) ; });
}

[Fact]
public void PreprocessingLexer_ExtraEndRegion()
{
var pp = new PreprocessingLexer();

var code = @"
#Область reg1
#КонецОбласти
#КонецОбласти
F";

pp.Code = code;
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
}

[Fact]
public void PreprocessingLexer_BadRegionName()
{
var pp = new PreprocessingLexer();

var code = @"
#Область -reg
#КонецОбласти
F";

pp.Code = code;
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
}

[Fact]
public void PreprocessingLexer_NoRegionName()
{
var pp = new PreprocessingLexer();

var code = @"
#Область
#КонецОбласти
F";

pp.Code = code;
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
}

[Fact]
public void PreprocessingLexer_NoRegionNameWithComment()
{
var pp = new PreprocessingLexer();

var code = @"
#Область // no name
#КонецОбласти
F";

pp.Code = code;
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
}

[Fact]
public void PreprocessingLexer_SymbolsAfterName()
{
var pp = new PreprocessingLexer();

var code = @"
#Область reg 00
#КонецОбласти
F";

pp.Code = code;
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
}

[Fact]
public void PreprocessingLexer_SymbolsAfterEndRegion()
{
var pp = new PreprocessingLexer();

var code = @"
#Область reg
#КонецОбласти reg
F";

pp.Code = code;
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
}

[Fact]
public void PreprocessingLexer_DirectiveAfterLineBreak()
{
var pp = new PreprocessingLexer();

var code = @"
#Область reg
#
КонецОбласти
F";

pp.Code = code;
Assert.Throws<SyntaxErrorException>(() => { while (pp.NextLexem().Token != Token.EndOfText) ; });
}

[Fact]
public void PreprocessingLexer_DirectiveNotOnNewLine()
{
var pp = new PreprocessingLexer();

var code = @"
#Область reg
F; #КонецОбласти
";

pp.Code = code;
Assert.Throws<SyntaxErrorException>(() => { while (pp.NextLexem().Token != Token.EndOfText) ; });
}

[Fact]
public void PreprocessingLexer_DirectiveNotOnSingleLine()
{
var pp = new PreprocessingLexer();

var code = @"
#Если Нет
Тогда
F;
#КонецОбласти
";

pp.Code = code;
Assert.Throws<SyntaxErrorException>(() => { while (pp.NextLexem().Token != Token.EndOfText) ; });
}

[Fact]
public void PreprocessingLexer_ExcludedLines()
{
var pp = new PreprocessingLexer();
pp.Define("Да");

var code = @"
#Если Да Тогда
F;
#Иначе
!!
#КонецЕсли
";

pp.Code = code;

Lexem lex;
do { lex = pp.NextLexem(); } while (pp.NextLexem().Token != Token.EndOfText);
Assert.Equal(Token.EndOfText, lex.Token);
}

private string GetPreprocessedContent(PreprocessingLexer pp, string code)
{
Expand Down
7 changes: 4 additions & 3 deletions src/OneScript.Language/CodePositionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ namespace OneScript.Language
{
public class CodePositionInfo
{
public const int OUT_OF_TEXT = -1;

public CodePositionInfo()
{
LineNumber = -1;
ColumnNumber = -1;
LineNumber = OUT_OF_TEXT;
ColumnNumber = OUT_OF_TEXT;
}

public int LineNumber { get; set; }
public int ColumnNumber { get; set; }
public string Code { get; set; }
public string ModuleName { get; set; }

public const int OUT_OF_TEXT = -1;
}
}
Loading

0 comments on commit 9673f28

Please sign in to comment.