Skip to content

Commit

Permalink
range path fragments for elements #170
Browse files Browse the repository at this point in the history
  • Loading branch information
cleftheris committed Oct 7, 2020
1 parent 8d5ed96 commit d282d12
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 1.9.12.{build}
version: 1.9.13.{build}
image: Visual Studio 2019
configuration: Release
platform: Any CPU
Expand Down
2 changes: 1 addition & 1 deletion src/indice.Edi/EdiPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace indice.Edi
public struct EdiPath : IComparable<EdiPath>, IEquatable<EdiPath>
{

private const string PARSE_PATTERN = @"^([A-Z]{1}[A-Z0-9]{1,3}|\*)?([\[\/]{1}([\d\.\*]+)\]?)?([\[\/]{1}([\d\.\*]+)\]?)?$"; // supports both "STX/2/1 and STX[2][1]"
private const string PARSE_PATTERN = @"^([A-Z]{1}[A-Z0-9]{1,3}|\*)?([\[\/]{1}([\d\.\*]+)\]?)?([\[\/]{1}(\d+?|\*)\]?)?$"; // supports both "STX/2/1 and STX[2][1]"

private readonly EdiPathFragment _SegmentPart;
private readonly EdiPathFragment _ElementPart;
Expand Down
2 changes: 1 addition & 1 deletion src/indice.Edi/EdiPathFragment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public int CompareTo(object obj) {
/// </summary>
/// <returns></returns>
public override string ToString() {
return IsWildcard ? "*" : Value;
return Value;
}

/// <summary>
Expand Down
23 changes: 12 additions & 11 deletions src/indice.Edi/indice.Edi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Description>Edi.Net Class Library</Description>
<Copyright>Copyright (c) 2015 Indice</Copyright>
<AssemblyTitle>Edi.Net</AssemblyTitle>
<VersionPrefix>1.9.12</VersionPrefix>
<VersionPrefix>1.9.13</VersionPrefix>
<!--<VersionSuffix>beta1</VersionSuffix>-->
<Authors>c.leftheris</Authors>
<TargetFrameworks>net40;net45;netstandard1.0;netstandard1.3;netstandard2.0</TargetFrameworks>
Expand All @@ -15,16 +15,17 @@
<PackageId>indice.Edi</PackageId>
<PackageTags>EDI;EDIFact;Tradacoms;X12;Serializer;Parser</PackageTags>
<PackageReleaseNotes>
- Support deserializing message fragment without interchange #137
- deserialize Functional group headers and trailers into a separate class #138
- Revisited Element List deserialization and serialization #121
- Fixed paths with wildcard fragments (segment and element) now serialize fine.
- Fixed writer serializing boolean values #141.
- Fixed EdiSerializer bug when using Serialize overload that passes a plain `TextWriter` the internal EdiTextWriter was never closed thus not autocompleteing/terminating the current active structure #142.
- Fixed EdiReader when empty segment was found without segment name delimiter #152.
- Introduced new `SuppressBadEscapeSequenceErrors` option on the serializer. it is used to suppress the exception error thrown when a malformed escape sequence is encountered #157.
- Rolledback v1.9.10 `EscapeCharacters` change #160.
- Introduced new `EscapeDecimalMarkInText`. It is used by the EdiTextWriter to escape the decimal mark character inside text values #160.
- Support deserializing message fragment without interchange #137
- deserialize Functional group headers and trailers into a separate class #138
- Revisited Element List deserialization and serialization #121
- Fixed paths with wildcard fragments (segment and element) now serialize fine.
- Fixed writer serializing boolean values #141.
- Fixed EdiSerializer bug when using Serialize overload that passes a plain `TextWriter` the internal EdiTextWriter was never closed thus not autocompleteing/terminating the current active structure #142.
- Fixed EdiReader when empty segment was found without segment name delimiter #152.
- Introduced new `SuppressBadEscapeSequenceErrors` option on the serializer. it is used to suppress the exception error thrown when a malformed escape sequence is encountered #157.
- Rolledback v1.9.10 `EscapeCharacters` change #160.
- Introduced new `EscapeDecimalMarkInText`. It is used by the EdiTextWriter to escape the decimal mark character inside text values #160.
- Added new path fragment notation for ranges. This allows for element ranges inside of a segment to be mapped to one structure while others to be mapped to #170.
</PackageReleaseNotes>
<PackageIcon>icon-256.png</PackageIcon>
<PackageProjectUrl>https://github.com/indice-co/EDI.Net</PackageProjectUrl>
Expand Down
11 changes: 11 additions & 0 deletions test/indice.Edi.Tests/EdiPathTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ public void ParseHandlesWildcards(string text) {
var path = EdiPath.Parse(text);
Assert.Equal("B10[*][0]", path.ToString());
}

[Trait(Traits.Tag, "Parser")]
[InlineData("B10[1..*][0]")]
[InlineData("B10/1..*/0")]
[InlineData("B10/1..*")]
[Theory]
public void ParseHandlesRangeStyleFragments(string text) {
var path = EdiPath.Parse(text);
Assert.True(path.Element.IsRange);
Assert.Equal("B10[1..*][0]", path.ToString());
}

[Trait(Traits.Tag, "Writer")]
[Fact]
Expand Down

0 comments on commit d282d12

Please sign in to comment.