Skip to content

Commit

Permalink
v1.9.5
Browse files Browse the repository at this point in the history
-minor multiline commentary analysis fix
  • Loading branch information
Sergey-Barkar committed Jul 24, 2023
1 parent 20b1c82 commit 49a8cec
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 45 deletions.
6 changes: 0 additions & 6 deletions AxBraceGuideLineExtension.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ VisualStudioVersion = 17.4.33122.133
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxBraceGuideLineExtension", "AxBraceGuideLineExtension\AxBraceGuideLineExtension.csproj", "{5E0D8C41-14CD-4076-BF73-E3E975799629}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{23A9F5BC-939E-47E8-B752-976C982B3124}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -17,10 +15,6 @@ Global
{5E0D8C41-14CD-4076-BF73-E3E975799629}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E0D8C41-14CD-4076-BF73-E3E975799629}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E0D8C41-14CD-4076-BF73-E3E975799629}.Release|Any CPU.Build.0 = Release|Any CPU
{23A9F5BC-939E-47E8-B752-976C982B3124}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23A9F5BC-939E-47E8-B752-976C982B3124}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23A9F5BC-939E-47E8-B752-976C982B3124}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23A9F5BC-939E-47E8-B752-976C982B3124}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using System;
using System.Collections.Generic;
using System.Linq;

namespace AxBraceGuideLineExtension
{
Expand Down Expand Up @@ -44,13 +45,13 @@ internal static void freeAll(this List<SourceCodeBlockRestrictionBase> _this)
}
}

internal static char[] getStartRestrictionChars(this List<SourceCodeBlockRestrictionBase> _this)
internal static char[] getHandlingChars(this List<SourceCodeBlockRestrictionBase> _this)
{
char[] ret = new char[_this.Count];
char[] ret = new char[0];

for (int j = 0; j < _this.Count; j++)
foreach(var restruction in _this)
{
ret[j] = _this[j].startRestrictionChar();
ret = ret.Union(restruction.getHandlingChars()).ToArray();
}

return ret;
Expand Down
4 changes: 2 additions & 2 deletions AxBraceGuideLineExtension/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.9.4.0")]
[assembly: AssemblyFileVersion("1.9.4.0")]
[assembly: AssemblyVersion("1.9.5.0")]
[assembly: AssemblyFileVersion("1.9.5.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

namespace AxBraceGuideLineExtension
{
internal interface ISourceCodeBlockRestriction
internal interface ISourceCodeBlockIncludeRestriction
{
char startRestrictionChar();
char endRestrictionChar();

char[] getHandlingChars();
bool tryToSetRestriction(ref string _analysingText, int _analysingIndex);
bool tryToRemoveRestriction(ref string _analysingText, int _analysingIndex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace AxBraceGuideLineExtension
{
internal abstract class SourceCodeBlockRestrictionBase : ISourceCodeBlockRestriction
internal abstract class SourceCodeBlockRestrictionBase : ISourceCodeBlockIncludeRestriction
{
public bool isRestructed { get; private set; }
protected int analysingIndex = default;
public abstract char startRestrictionChar();
public abstract char endRestrictionChar();
public abstract char[] getHandlingChars();
public abstract bool isSetRestriction(char _analysingChar);
public abstract bool isRemoveRestriction(char _analysingChar);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ internal class SourceCodeBlockRestriction_MultiLineComment : SourceCodeBlockRest
{
private const char asteriskChar = '*';

public override char endRestrictionChar()
public override char[] getHandlingChars()
{
return asteriskChar;
return new char[] { slashChar, asteriskChar };
}

public override bool isSetRestriction(char _analysingChar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@ internal class SourceCodeBlockRestriction_SingleLineComment : SourceCodeBlockRes
protected const char slashChar = '/';
protected int? previousMatchingAnalysedIndex = default;

public sealed override char startRestrictionChar()
public override char[] getHandlingChars()
{
return slashChar;
}

public override char endRestrictionChar()
{
return newLineAsciiChar;
return new char[] { slashChar, newLineAsciiChar };
}

public override bool isSetRestriction(char _analysingChar)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,9 @@ internal class SourceCodeBlockRestriction_SingleQuoteString : SourceCodeBlockRes
{
protected virtual char quoteChar => '\'';

public sealed override char startRestrictionChar()
public sealed override char[] getHandlingChars()
{
return quoteChar;
}

public sealed override char endRestrictionChar()
{
return quoteChar;
return new char[] { quoteChar };
}

public sealed override bool isSetRestriction(char _analysingChar)
Expand Down
13 changes: 3 additions & 10 deletions AxBraceGuideLineExtension/XppParser/BlockBraceParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private BlockBraceParser()
{
result = new List<BlockSpan>();
restrictions = SourceCodeBlockRestrictionBase.createInheritors();
analysingChars = new char[3] { curlyBracketLeft, curlyBracketRight, newLineWindowsChar }.Union(restrictions.getStartRestrictionChars()).ToArray();
analysingChars = new char[3] { curlyBracketLeft, curlyBracketRight, newLineWindowsChar }.Union(restrictions.getHandlingChars()).ToArray();
}

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

do
{
if (activeRestruction is null)
{
index = _xppCode.IndexOfAny(analysingChars, index + 1);
}
else
{
index = _xppCode.IndexOf(activeRestruction.endRestrictionChar(), index + 1);
}
index = _xppCode.IndexOfAny(activeRestruction is null ? analysingChars : activeRestruction.getHandlingChars(), index + 1);

if (!index.isNegative())
{
Expand Down Expand Up @@ -115,7 +108,7 @@ public void Parse(string _xppCode)
while (index != indexNotFound);

restrictions.freeAll();

result.Sort(BlockSpanSorter.Instance);

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

0 comments on commit 49a8cec

Please sign in to comment.