Skip to content

Commit 49a8cec

Browse files
committed
v1.9.5
-minor multiline commentary analysis fix
1 parent 20b1c82 commit 49a8cec

9 files changed

+21
-45
lines changed

AxBraceGuideLineExtension.sln

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ VisualStudioVersion = 17.4.33122.133
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxBraceGuideLineExtension", "AxBraceGuideLineExtension\AxBraceGuideLineExtension.csproj", "{5E0D8C41-14CD-4076-BF73-E3E975799629}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{23A9F5BC-939E-47E8-B752-976C982B3124}"
9-
EndProject
108
Global
119
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1210
Debug|Any CPU = Debug|Any CPU
@@ -17,10 +15,6 @@ Global
1715
{5E0D8C41-14CD-4076-BF73-E3E975799629}.Debug|Any CPU.Build.0 = Debug|Any CPU
1816
{5E0D8C41-14CD-4076-BF73-E3E975799629}.Release|Any CPU.ActiveCfg = Release|Any CPU
1917
{5E0D8C41-14CD-4076-BF73-E3E975799629}.Release|Any CPU.Build.0 = Release|Any CPU
20-
{23A9F5BC-939E-47E8-B752-976C982B3124}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21-
{23A9F5BC-939E-47E8-B752-976C982B3124}.Debug|Any CPU.Build.0 = Debug|Any CPU
22-
{23A9F5BC-939E-47E8-B752-976C982B3124}.Release|Any CPU.ActiveCfg = Release|Any CPU
23-
{23A9F5BC-939E-47E8-B752-976C982B3124}.Release|Any CPU.Build.0 = Release|Any CPU
2418
EndGlobalSection
2519
GlobalSection(SolutionProperties) = preSolution
2620
HideSolutionNode = FALSE

AxBraceGuideLineExtension/Extensions/ListOfSourceCodeBlockIncludeRestrictionBaseExtension.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1515

1616
using System;
1717
using System.Collections.Generic;
18+
using System.Linq;
1819

1920
namespace AxBraceGuideLineExtension
2021
{
@@ -44,13 +45,13 @@ internal static void freeAll(this List<SourceCodeBlockRestrictionBase> _this)
4445
}
4546
}
4647

47-
internal static char[] getStartRestrictionChars(this List<SourceCodeBlockRestrictionBase> _this)
48+
internal static char[] getHandlingChars(this List<SourceCodeBlockRestrictionBase> _this)
4849
{
49-
char[] ret = new char[_this.Count];
50+
char[] ret = new char[0];
5051

51-
for (int j = 0; j < _this.Count; j++)
52+
foreach(var restruction in _this)
5253
{
53-
ret[j] = _this[j].startRestrictionChar();
54+
ret = ret.Union(restruction.getHandlingChars()).ToArray();
5455
}
5556

5657
return ret;

AxBraceGuideLineExtension/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// Можно задать все значения или принять номера сборки и редакции по умолчанию
3333
// используя "*", как показано ниже:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.9.4.0")]
36-
[assembly: AssemblyFileVersion("1.9.4.0")]
35+
[assembly: AssemblyVersion("1.9.5.0")]
36+
[assembly: AssemblyFileVersion("1.9.5.0")]

AxBraceGuideLineExtension/SourceCodeBlockIncludeRestrictions/ISourceCodeBlockRestriction.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1515

1616
namespace AxBraceGuideLineExtension
1717
{
18-
internal interface ISourceCodeBlockRestriction
18+
internal interface ISourceCodeBlockIncludeRestriction
1919
{
20-
char startRestrictionChar();
21-
char endRestrictionChar();
22-
20+
char[] getHandlingChars();
2321
bool tryToSetRestriction(ref string _analysingText, int _analysingIndex);
2422
bool tryToRemoveRestriction(ref string _analysingText, int _analysingIndex);
2523
}

AxBraceGuideLineExtension/SourceCodeBlockIncludeRestrictions/SourceCodeBlockRestrictionBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1717
using System.Collections.Generic;
1818
using System.Linq;
1919
using System.Reflection;
20+
using System.Text;
2021

2122
namespace AxBraceGuideLineExtension
2223
{
23-
internal abstract class SourceCodeBlockRestrictionBase : ISourceCodeBlockRestriction
24+
internal abstract class SourceCodeBlockRestrictionBase : ISourceCodeBlockIncludeRestriction
2425
{
2526
public bool isRestructed { get; private set; }
2627
protected int analysingIndex = default;
27-
public abstract char startRestrictionChar();
28-
public abstract char endRestrictionChar();
28+
public abstract char[] getHandlingChars();
2929
public abstract bool isSetRestriction(char _analysingChar);
3030
public abstract bool isRemoveRestriction(char _analysingChar);
3131

AxBraceGuideLineExtension/SourceCodeBlockIncludeRestrictions/SourceCodeBlockRestriction_MultiLineComment.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ internal class SourceCodeBlockRestriction_MultiLineComment : SourceCodeBlockRest
1919
{
2020
private const char asteriskChar = '*';
2121

22-
public override char endRestrictionChar()
22+
public override char[] getHandlingChars()
2323
{
24-
return asteriskChar;
24+
return new char[] { slashChar, asteriskChar };
2525
}
2626

2727
public override bool isSetRestriction(char _analysingChar)

AxBraceGuideLineExtension/SourceCodeBlockIncludeRestrictions/SourceCodeBlockRestriction_SingleLineComment.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,9 @@ internal class SourceCodeBlockRestriction_SingleLineComment : SourceCodeBlockRes
2121
protected const char slashChar = '/';
2222
protected int? previousMatchingAnalysedIndex = default;
2323

24-
public sealed override char startRestrictionChar()
24+
public override char[] getHandlingChars()
2525
{
26-
return slashChar;
27-
}
28-
29-
public override char endRestrictionChar()
30-
{
31-
return newLineAsciiChar;
26+
return new char[] { slashChar, newLineAsciiChar };
3227
}
3328

3429
public override bool isSetRestriction(char _analysingChar)

AxBraceGuideLineExtension/SourceCodeBlockIncludeRestrictions/SourceCodeBlockRestriction_SingleQuoteString.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,9 @@ internal class SourceCodeBlockRestriction_SingleQuoteString : SourceCodeBlockRes
1919
{
2020
protected virtual char quoteChar => '\'';
2121

22-
public sealed override char startRestrictionChar()
22+
public sealed override char[] getHandlingChars()
2323
{
24-
return quoteChar;
25-
}
26-
27-
public sealed override char endRestrictionChar()
28-
{
29-
return quoteChar;
24+
return new char[] { quoteChar };
3025
}
3126

3227
public sealed override bool isSetRestriction(char _analysingChar)

AxBraceGuideLineExtension/XppParser/BlockBraceParser.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private BlockBraceParser()
3636
{
3737
result = new List<BlockSpan>();
3838
restrictions = SourceCodeBlockRestrictionBase.createInheritors();
39-
analysingChars = new char[3] { curlyBracketLeft, curlyBracketRight, newLineWindowsChar }.Union(restrictions.getStartRestrictionChars()).ToArray();
39+
analysingChars = new char[3] { curlyBracketLeft, curlyBracketRight, newLineWindowsChar }.Union(restrictions.getHandlingChars()).ToArray();
4040
}
4141

4242
internal List<BlockSpan> Parse(ITextSnapshot _textSnapshot)
@@ -65,14 +65,7 @@ public void Parse(string _xppCode)
6565

6666
do
6767
{
68-
if (activeRestruction is null)
69-
{
70-
index = _xppCode.IndexOfAny(analysingChars, index + 1);
71-
}
72-
else
73-
{
74-
index = _xppCode.IndexOf(activeRestruction.endRestrictionChar(), index + 1);
75-
}
68+
index = _xppCode.IndexOfAny(activeRestruction is null ? analysingChars : activeRestruction.getHandlingChars(), index + 1);
7669

7770
if (!index.isNegative())
7871
{
@@ -115,7 +108,7 @@ public void Parse(string _xppCode)
115108
while (index != indexNotFound);
116109

117110
restrictions.freeAll();
118-
111+
119112
result.Sort(BlockSpanSorter.Instance);
120113

121114
Dictionary<int, List<Span>> keyValuePairs = new Dictionary<int, List<Span>>();

0 commit comments

Comments
 (0)