Skip to content

Commit 9673f28

Browse files
author
Andrey Ovsiankin
committed
Merge branch 'release/v1.5.0'
2 parents 7cc7963 + e1a9e1e commit 9673f28

File tree

81 files changed

+5921
-482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+5921
-482
lines changed

Build.csproj

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333

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

36-
</Target>
37-
38-
<Target Name="Make">
36+
</Target>
37+
<Target Name="Make">
3938
<MSBuild Projects="$(Solution)" Targets="restore;Build" Properties="ReleaseNumber=$(ReleaseNumber);Configuration=$(Configuration);Platform=%(PlatformItem.MSBuildName);"/>
4039
</Target>
4140

@@ -84,7 +83,17 @@
8483
</BinaryFiles>
8584
<AspFiles Include="$(MSBuildProjectDirectory)/src/ASPNETHandler/bin/$(Configuration)/net452/ASPNETHandler.dll"/>
8685
</ItemGroup>
87-
86+
87+
<ItemGroup>
88+
<BuiltProjects Include="ScriptEngine.NativeApi" />
89+
<BinaryFiles Include="$(MSBuildProjectDirectory)/src/%(BuiltProjects.Identity)/bin/$(Configuration)/net452/*.dll">
90+
<Dest>$(TempFolder)/bin</Dest>
91+
</BinaryFiles>
92+
<BinaryFiles Include="$(MSBuildProjectDirectory)/src/%(BuiltProjects.Identity)/bin/x86/$(Configuration)/net452/*.dll">
93+
<Dest>$(TempFolder)/bin32</Dest>
94+
</BinaryFiles>
95+
</ItemGroup>
96+
8897
<Copy SourceFiles="@(BinaryFiles)" DestinationFiles="@(BinaryFiles->'%(Dest)/%(Filename)%(Extension)')" />
8998
<Copy SourceFiles="@(AspFiles)" DestinationFolder="%(BinaryFiles.Dest)"/>
9099
<!-- Копирование скрипта запуска для opm -->
@@ -238,4 +247,4 @@
238247

239248
</Target>
240249

241-
</Project>
250+
</Project>

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pipeline {
44
agent none
55

66
environment {
7-
ReleaseNumber = '1.4.0'
7+
ReleaseNumber = '1.5.0'
88
outputEnc = '65001'
99
}
1010

install/install.iss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Name: "docs"; Description: "Документация по свойствам и
5858
[Files]
5959
Source: "{#ArtifactRoot}\{#Binaries}\oscript.exe"; DestDir: "{app}\bin"; Components: main
6060
Source: "{#ArtifactRoot}\{#Binaries}\ScriptEngine.HostedScript.dll"; DestDir: "{app}\bin"; Components: main
61+
Source: "{#ArtifactRoot}\{#Binaries}\ScriptEngine.NativeApi.dll"; DestDir: "{app}\bin"; Components: main
6162
Source: "{#ArtifactRoot}\{#Binaries}\ScriptEngine.dll"; DestDir: "{app}\bin"; Components: main
6263
Source: "{#ArtifactRoot}\{#Binaries}\OneScript.DebugProtocol.dll"; DestDir: "{app}\bin"; Components: main
6364
Source: "{#ArtifactRoot}\{#Binaries}\OneScript.DebugServices.dll"; DestDir: "{app}\bin"; Components: main
@@ -200,4 +201,4 @@ begin
200201
end;
201202
202203
result := true;
203-
end;
204+
end;

src/1Script.sln

Lines changed: 139 additions & 68 deletions
Large diffs are not rendered by default.

src/OneScript.Language.Tests/LexerTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ public void Word_Literals_Processed_Correctly()
279279
[Fact]
280280
public void Preprocessor_Lexem_ProcessedCorrectly()
281281
{
282-
string code = "#Если #КонецЕсли";
282+
string code = @"#Если
283+
#КонецЕсли";
283284

284285
var iterator = new SourceCodeIterator(code);
285286
var wordParser = new PreprocessorDirectiveLexerState();

src/OneScript.Language.Tests/PreprocessorTests.cs

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,285 @@ public void PriorityOperators_WithParenthesis()
316316

317317
Assert.Equal(Token.EndOfText, lex.Token);
318318
}
319+
320+
[Fact]
321+
public void ParsingFirstNot()
322+
{
323+
var pp = new PreprocessingLexer();
324+
pp.Define("Да");
325+
326+
var code = @"
327+
#Если Не Да Тогда
328+
F;
329+
#КонецЕсли";
330+
331+
pp.Code = code;
332+
333+
var lex = pp.NextLexem();
334+
335+
Assert.Equal(Token.EndOfText, lex.Token);
336+
}
337+
338+
[Fact]
339+
public void PreprocessingLexer_Unclosed_ElseBlock()
340+
{
341+
var pp = new PreprocessingLexer();
342+
pp.Define("Да");
343+
344+
var code = @"
345+
#Если Да и Не Да Тогда
346+
F;
347+
#Иначе
348+
G;
349+
";
350+
351+
pp.Code = code;
352+
353+
Assert.Throws<SyntaxErrorException>(() => {while (pp.NextLexem().Token != Token.EndOfText);});
354+
}
355+
356+
[Fact]
357+
public void PreprocessingLexer_Endif_Without_If()
358+
{
359+
var pp = new PreprocessingLexer();
360+
pp.Define("Да");
361+
362+
var code = @"
363+
#КонецЕсли
364+
H;
365+
";
366+
367+
pp.Code = code;
368+
369+
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
370+
}
371+
372+
[Fact]
373+
public void PreprocessingLexer_Extra_Endif()
374+
{
375+
var pp = new PreprocessingLexer();
376+
pp.Define("Да");
377+
378+
var code = @"
379+
#Если Да Тогда
380+
F;
381+
#КонецЕсли
382+
#КонецЕсли
383+
";
384+
385+
pp.Code = code;
386+
387+
Assert.Throws<SyntaxErrorException>(() => {while (pp.NextLexem().Token != Token.EndOfText);});
388+
}
389+
390+
[Fact]
391+
public void PreprocessingLexer_SimpleRegion()
392+
{
393+
var pp = new PreprocessingLexer();
394+
395+
var code = @"
396+
#Область reg1
397+
398+
#КонецОбласти
399+
F";
400+
401+
pp.Code = code;
402+
var lex = pp.NextLexem();
403+
Assert.Equal("F", lex.Content);
404+
}
405+
406+
[Fact]
407+
public void PreprocessingLexer_MultipleNestedRegions()
408+
{
409+
var pp = new PreprocessingLexer();
410+
411+
var code = @"
412+
#Region reg1
413+
#Область reg2
414+
415+
#Область if // keywords are ok
416+
417+
#endRegion
418+
#КонецОбласти // reg 1
419+
420+
#endRegion
421+
# Область reg1 // same name is ok
422+
423+
#КонецОбласти
424+
F";
425+
426+
pp.Code = code;
427+
var lex = pp.NextLexem();
428+
Assert.Equal("F", lex.Content);
429+
}
430+
431+
432+
[Fact]
433+
public void PreprocessingLexer_NoEndRegion()
434+
{
435+
var pp = new PreprocessingLexer();
436+
437+
var code = @"
438+
#Область reg1
439+
#Область reg2
440+
#КонецОбласти
441+
F";
442+
443+
pp.Code = code;
444+
Assert.Throws<SyntaxErrorException>(() => { while (pp.NextLexem().Token != Token.EndOfText) ; });
445+
}
446+
447+
[Fact]
448+
public void PreprocessingLexer_ExtraEndRegion()
449+
{
450+
var pp = new PreprocessingLexer();
451+
452+
var code = @"
453+
#Область reg1
454+
#КонецОбласти
455+
#КонецОбласти
456+
F";
457+
458+
pp.Code = code;
459+
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
460+
}
461+
462+
[Fact]
463+
public void PreprocessingLexer_BadRegionName()
464+
{
465+
var pp = new PreprocessingLexer();
466+
467+
var code = @"
468+
#Область -reg
469+
#КонецОбласти
470+
F";
471+
472+
pp.Code = code;
473+
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
474+
}
475+
476+
[Fact]
477+
public void PreprocessingLexer_NoRegionName()
478+
{
479+
var pp = new PreprocessingLexer();
480+
481+
var code = @"
482+
#Область
483+
#КонецОбласти
484+
F";
485+
486+
pp.Code = code;
487+
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
488+
}
489+
490+
[Fact]
491+
public void PreprocessingLexer_NoRegionNameWithComment()
492+
{
493+
var pp = new PreprocessingLexer();
494+
495+
var code = @"
496+
#Область // no name
497+
#КонецОбласти
498+
F";
499+
500+
pp.Code = code;
501+
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
502+
}
503+
504+
[Fact]
505+
public void PreprocessingLexer_SymbolsAfterName()
506+
{
507+
var pp = new PreprocessingLexer();
508+
509+
var code = @"
510+
#Область reg 00
511+
#КонецОбласти
512+
F";
513+
514+
pp.Code = code;
515+
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
516+
}
517+
518+
[Fact]
519+
public void PreprocessingLexer_SymbolsAfterEndRegion()
520+
{
521+
var pp = new PreprocessingLexer();
522+
523+
var code = @"
524+
#Область reg
525+
#КонецОбласти reg
526+
F";
527+
528+
pp.Code = code;
529+
Assert.Throws<SyntaxErrorException>(() => pp.NextLexem());
530+
}
531+
532+
[Fact]
533+
public void PreprocessingLexer_DirectiveAfterLineBreak()
534+
{
535+
var pp = new PreprocessingLexer();
536+
537+
var code = @"
538+
#Область reg
539+
#
540+
541+
КонецОбласти
542+
F";
543+
544+
pp.Code = code;
545+
Assert.Throws<SyntaxErrorException>(() => { while (pp.NextLexem().Token != Token.EndOfText) ; });
546+
}
547+
548+
[Fact]
549+
public void PreprocessingLexer_DirectiveNotOnNewLine()
550+
{
551+
var pp = new PreprocessingLexer();
552+
553+
var code = @"
554+
#Область reg
555+
F; #КонецОбласти
556+
";
557+
558+
pp.Code = code;
559+
Assert.Throws<SyntaxErrorException>(() => { while (pp.NextLexem().Token != Token.EndOfText) ; });
560+
}
561+
562+
[Fact]
563+
public void PreprocessingLexer_DirectiveNotOnSingleLine()
564+
{
565+
var pp = new PreprocessingLexer();
566+
567+
var code = @"
568+
#Если Нет
569+
Тогда
570+
F;
571+
#КонецОбласти
572+
";
573+
574+
pp.Code = code;
575+
Assert.Throws<SyntaxErrorException>(() => { while (pp.NextLexem().Token != Token.EndOfText) ; });
576+
}
577+
578+
[Fact]
579+
public void PreprocessingLexer_ExcludedLines()
580+
{
581+
var pp = new PreprocessingLexer();
582+
pp.Define("Да");
583+
584+
var code = @"
585+
#Если Да Тогда
586+
F;
587+
#Иначе
588+
!!
589+
#КонецЕсли
590+
";
591+
592+
pp.Code = code;
593+
594+
Lexem lex;
595+
do { lex = pp.NextLexem(); } while (pp.NextLexem().Token != Token.EndOfText);
596+
Assert.Equal(Token.EndOfText, lex.Token);
597+
}
319598

320599
private string GetPreprocessedContent(PreprocessingLexer pp, string code)
321600
{

src/OneScript.Language/CodePositionInfo.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ namespace OneScript.Language
99
{
1010
public class CodePositionInfo
1111
{
12+
public const int OUT_OF_TEXT = -1;
13+
1214
public CodePositionInfo()
1315
{
14-
LineNumber = -1;
15-
ColumnNumber = -1;
16+
LineNumber = OUT_OF_TEXT;
17+
ColumnNumber = OUT_OF_TEXT;
1618
}
1719

1820
public int LineNumber { get; set; }
1921
public int ColumnNumber { get; set; }
2022
public string Code { get; set; }
2123
public string ModuleName { get; set; }
2224

23-
public const int OUT_OF_TEXT = -1;
2425
}
2526
}

0 commit comments

Comments
 (0)