-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use file scoped namespaces
- Loading branch information
Showing
36 changed files
with
1,698 additions
and
1,734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
namespace GlobExpressions.AST | ||
namespace GlobExpressions.AST; | ||
|
||
internal sealed class CharacterWildcard : SubSegment | ||
{ | ||
internal sealed class CharacterWildcard : SubSegment | ||
{ | ||
public static readonly CharacterWildcard Default = new CharacterWildcard(); | ||
public static readonly CharacterWildcard Default = new CharacterWildcard(); | ||
|
||
private CharacterWildcard() | ||
: base(GlobNodeType.CharacterWildcard) | ||
{ | ||
private CharacterWildcard() | ||
: base(GlobNodeType.CharacterWildcard) | ||
{ | ||
} | ||
|
||
public override string ToString() => "?"; | ||
} | ||
} | ||
public override string ToString() => "?"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace GlobExpressions.AST | ||
namespace GlobExpressions.AST; | ||
|
||
internal sealed class DirectorySegment : Segment | ||
{ | ||
internal sealed class DirectorySegment : Segment | ||
{ | ||
public SubSegment[] SubSegments { get; } | ||
public SubSegment[] SubSegments { get; } | ||
|
||
public DirectorySegment(IEnumerable<SubSegment> subSegments) | ||
: base(GlobNodeType.DirectorySegment) | ||
{ | ||
public DirectorySegment(IEnumerable<SubSegment> subSegments) | ||
: base(GlobNodeType.DirectorySegment) | ||
{ | ||
SubSegments = subSegments.ToArray(); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
public override string ToString() | ||
{ | ||
return string.Join("", SubSegments.Select(x => x.ToString())); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
namespace GlobExpressions.AST | ||
namespace GlobExpressions.AST; | ||
|
||
internal sealed class DirectoryWildcard : Segment | ||
{ | ||
internal sealed class DirectoryWildcard : Segment | ||
{ | ||
public static readonly DirectoryWildcard Default = new DirectoryWildcard(); | ||
public static readonly DirectoryWildcard Default = new DirectoryWildcard(); | ||
|
||
private DirectoryWildcard() | ||
: base(GlobNodeType.DirectoryWildcard) | ||
{ | ||
private DirectoryWildcard() | ||
: base(GlobNodeType.DirectoryWildcard) | ||
{ | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
public override string ToString() | ||
{ | ||
return "**"; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
namespace GlobExpressions.AST | ||
namespace GlobExpressions.AST; | ||
|
||
internal abstract class GlobNode | ||
{ | ||
internal abstract class GlobNode | ||
protected GlobNode(GlobNodeType type) | ||
{ | ||
protected GlobNode(GlobNodeType type) | ||
{ | ||
this.Type = type; | ||
} | ||
|
||
public GlobNodeType Type { get; } | ||
} | ||
} | ||
public GlobNodeType Type { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
namespace GlobExpressions.AST | ||
namespace GlobExpressions.AST; | ||
|
||
internal enum GlobNodeType | ||
{ | ||
internal enum GlobNodeType | ||
{ | ||
Tree, | ||
Tree, | ||
|
||
// Segments | ||
Root, | ||
// Segments | ||
Root, | ||
|
||
DirectoryWildcard, | ||
DirectorySegment, | ||
DirectoryWildcard, | ||
DirectorySegment, | ||
|
||
// SubSegments | ||
CharacterSet, | ||
// SubSegments | ||
CharacterSet, | ||
|
||
Identifier, | ||
LiteralSet, | ||
StringWildcard, | ||
CharacterWildcard | ||
} | ||
Identifier, | ||
LiteralSet, | ||
StringWildcard, | ||
CharacterWildcard | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
namespace GlobExpressions.AST | ||
namespace GlobExpressions.AST; | ||
|
||
internal sealed class Identifier : SubSegment | ||
{ | ||
internal sealed class Identifier : SubSegment | ||
{ | ||
public string Value { get; } | ||
public string Value { get; } | ||
|
||
public Identifier(string value) | ||
: base(GlobNodeType.Identifier) | ||
{ | ||
Value = value; | ||
} | ||
public Identifier(string value) | ||
: base(GlobNodeType.Identifier) | ||
{ | ||
Value = value; | ||
} | ||
|
||
public override string ToString() => Value; | ||
public override string ToString() => Value; | ||
|
||
public static implicit operator Identifier(string value) | ||
{ | ||
return new Identifier(value); | ||
} | ||
public static implicit operator Identifier(string value) | ||
{ | ||
return new Identifier(value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace GlobExpressions.AST | ||
namespace GlobExpressions.AST; | ||
|
||
internal sealed class LiteralSet : SubSegment | ||
{ | ||
internal sealed class LiteralSet : SubSegment | ||
{ | ||
public Identifier[] Literals { get; } | ||
public Identifier[] Literals { get; } | ||
|
||
public LiteralSet(params Identifier[] literals) | ||
: base(GlobNodeType.LiteralSet) | ||
{ | ||
public LiteralSet(params Identifier[] literals) | ||
: base(GlobNodeType.LiteralSet) | ||
{ | ||
Literals = literals.ToArray(); | ||
} | ||
|
||
public LiteralSet(IEnumerable<Identifier> literals) | ||
: base(GlobNodeType.LiteralSet) | ||
{ | ||
public LiteralSet(IEnumerable<Identifier> literals) | ||
: base(GlobNodeType.LiteralSet) | ||
{ | ||
Literals = literals.ToArray(); | ||
} | ||
|
||
public override string ToString() => $"{{{string.Join(",", Literals.Select(lit => lit.ToString()))}}}"; | ||
} | ||
} | ||
public override string ToString() => $"{{{string.Join(",", Literals.Select(lit => lit.ToString()))}}}"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
namespace GlobExpressions.AST | ||
namespace GlobExpressions.AST; | ||
|
||
internal sealed class Root : Segment | ||
{ | ||
internal sealed class Root : Segment | ||
{ | ||
public string Text { get; } | ||
public string Text { get; } | ||
|
||
public Root(string text = "") | ||
: base(GlobNodeType.Root) | ||
{ | ||
public Root(string text = "") | ||
: base(GlobNodeType.Root) | ||
{ | ||
Text = text; | ||
} | ||
|
||
public override string ToString() => Text; | ||
} | ||
} | ||
public override string ToString() => Text; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
namespace GlobExpressions.AST | ||
namespace GlobExpressions.AST; | ||
|
||
internal abstract class Segment : GlobNode | ||
{ | ||
internal abstract class Segment : GlobNode | ||
protected Segment(GlobNodeType type) | ||
: base(type) | ||
{ | ||
protected Segment(GlobNodeType type) | ||
: base(type) | ||
{ | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.