Skip to content

Commit dea5189

Browse files
committed
net5.0 target; fixes; use ParserConstruction namespace for Superpower types
1 parent da683a0 commit dea5189

39 files changed

+62
-81
lines changed

src/Serilog.Expressions/Expressions/Ast/ConstantExpression.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public override string ToString()
2828
case IFormattable formattable:
2929
return formattable.ToString(null, CultureInfo.InvariantCulture);
3030
default:
31-
return (sv.Value ?? "null").ToString();
31+
return (sv.Value ?? "null").ToString() ?? "<ToString() returned null>";
3232
}
3333
}
3434

src/Serilog.Expressions/Expressions/Parsing/Combinators.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System;
2-
using Serilog.Superpower;
3-
using Serilog.Superpower.Model;
42

53
namespace Serilog.Expressions.Parsing
64
{

src/Serilog.Expressions/Expressions/Parsing/ExpressionTextParsers.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using Serilog.Superpower;
2-
using Serilog.Superpower.Model;
3-
using Serilog.Superpower.Parsers;
4-
5-
namespace Serilog.Expressions.Parsing
1+
namespace Serilog.Expressions.Parsing
62
{
73
static class ExpressionTextParsers
84
{

src/Serilog.Expressions/Expressions/Parsing/ExpressionToken.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using Serilog.Superpower.Display;
2-
3-
namespace Serilog.Expressions.Parsing
1+
namespace Serilog.Expressions.Parsing
42
{
53
enum ExpressionToken
64
{

src/Serilog.Expressions/Expressions/Parsing/ExpressionTokenParsers.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
using System.Linq;
44
using Serilog.Events;
55
using Serilog.Expressions.Ast;
6-
using Serilog.Superpower;
7-
using Serilog.Superpower.Model;
8-
using Serilog.Superpower.Parsers;
96

107
namespace Serilog.Expressions.Parsing
118
{

src/Serilog.Expressions/Expressions/Parsing/ExpressionTokenizer.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System.Collections.Generic;
22
using System.Linq;
3-
using Serilog.Superpower;
4-
using Serilog.Superpower.Model;
53

64
namespace Serilog.Expressions.Parsing
75
{

src/Serilog.Expressions/Expressions/Parsing/ParserExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
using System;
2-
using Serilog.Superpower;
3-
using Serilog.Superpower.Model;
42

53
namespace Serilog.Expressions.Parsing
64
{

src/Serilog.Expressions/Expressions/Runtime/Coerce.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static bool String(LogEventPropertyValue? value, [MaybeNullWhen(false)] o
6262

6363
if (sv.Value?.GetType().IsEnum ?? false)
6464
{
65-
str = sv.Value.ToString();
65+
str = sv.Value.ToString()!;
6666
return true;
6767
}
6868
}

src/Serilog.Expressions/Expressions/Runtime/RuntimeOperators.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,14 @@ public static LogEventPropertyValue _Internal_IsNotNull(LogEventPropertyValue? v
470470

471471
public static LogEventPropertyValue? ToString(LogEventPropertyValue? value, LogEventPropertyValue? format)
472472
{
473-
if (!(value is ScalarValue sv) ||
473+
if (value is not ScalarValue sv ||
474474
sv.Value == null ||
475-
!(Coerce.String(format, out var fmt) || format == null || format is ScalarValue { Value: null }))
475+
!(Coerce.String(format, out var fmt) || format is null or ScalarValue { Value: null }))
476476
{
477477
return null;
478478
}
479479

480-
string toString;
480+
string? toString;
481481
if (sv.Value is IFormattable formattable)
482482
{
483483
// TODO #19: formatting is culture-specific.

src/Serilog.Expressions/Expressions/StaticMemberNameResolver.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics.CodeAnalysis;
34
using System.Linq;
45
using System.Reflection;
56

@@ -27,9 +28,9 @@ public StaticMemberNameResolver(Type type)
2728
}
2829

2930
/// <inheritdoc />
30-
public override bool TryResolveFunctionName(string name, out MethodInfo implementation)
31+
public override bool TryResolveFunctionName(string name, [MaybeNullWhen(false)] out MethodInfo implementation)
3132
{
3233
return _methods.TryGetValue(name, out implementation);
3334
}
3435
}
35-
}
36+
}

src/Serilog.Expressions/Superpower/Combinators.cs renamed to src/Serilog.Expressions/ParserConstruction/Combinators.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414

1515
using System;
1616
using System.Collections.Generic;
17-
using Serilog.Superpower.Display;
18-
using Serilog.Superpower.Model;
19-
using Serilog.Superpower.Util;
17+
using Serilog.ParserConstruction.Display;
18+
using Serilog.ParserConstruction.Model;
19+
using Serilog.ParserConstruction.Util;
2020

2121
// ReSharper disable MemberCanBePrivate.Global
2222

23-
namespace Serilog.Superpower
23+
namespace Serilog.ParserConstruction
2424
{
2525
/// <summary>
2626
/// Functions that construct more complex parsers by combining simpler ones.

src/Serilog.Expressions/Superpower/Display/Presentation.cs renamed to src/Serilog.Expressions/ParserConstruction/Display/Presentation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
using System;
1616
using System.Reflection;
17-
using Serilog.Superpower.Util;
17+
using Serilog.ParserConstruction.Util;
1818

19-
namespace Serilog.Superpower.Display
19+
namespace Serilog.ParserConstruction.Display
2020
{
2121
static class Presentation
2222
{

src/Serilog.Expressions/Superpower/Display/TokenAttribute.cs renamed to src/Serilog.Expressions/ParserConstruction/Display/TokenAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
// ReSharper disable UnusedAutoPropertyAccessor.Global, ClassNeverInstantiated.Global
1818

19-
namespace Serilog.Superpower.Display
19+
namespace Serilog.ParserConstruction.Display
2020
{
2121
/// <summary>
2222
/// Applied to enum members representing tokens to control how they are rendered.

src/Serilog.Expressions/Superpower/Model/Position.cs renamed to src/Serilog.Expressions/ParserConstruction/Model/Position.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
namespace Serilog.Superpower.Model
15+
namespace Serilog.ParserConstruction.Model
1616
{
1717
/// <summary>
1818
/// A position within a stream of character input.

src/Serilog.Expressions/Superpower/Model/Result.cs renamed to src/Serilog.Expressions/ParserConstruction/Model/Result.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
using Serilog.Superpower.Util;
15+
using Serilog.ParserConstruction.Util;
1616

17-
namespace Serilog.Superpower.Model
17+
namespace Serilog.ParserConstruction.Model
1818
{
1919
/// <summary>
2020
/// Helper methods for working with <see cref="Result{T}"/>.

src/Serilog.Expressions/Superpower/Model/Result`1.cs renamed to src/Serilog.Expressions/ParserConstruction/Model/Result`1.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
// limitations under the License.
1414

1515
using System;
16-
using Serilog.Superpower.Util;
16+
using Serilog.ParserConstruction.Util;
1717

18-
namespace Serilog.Superpower.Model
18+
namespace Serilog.ParserConstruction.Model
1919
{
2020
/// <summary>
2121
/// The result of parsing from a text span.

src/Serilog.Expressions/Superpower/Model/TextSpan.cs renamed to src/Serilog.Expressions/ParserConstruction/Model/TextSpan.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
using System;
1616

17-
namespace Serilog.Superpower.Model
17+
namespace Serilog.ParserConstruction.Model
1818
{
1919
/// <summary>
2020
/// A span of text within a larger string.

src/Serilog.Expressions/Superpower/Model/TokenListParserResult.cs renamed to src/Serilog.Expressions/ParserConstruction/Model/TokenListParserResult.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
namespace Serilog.Superpower.Model
15+
namespace Serilog.ParserConstruction.Model
1616
{
1717
/// <summary>
1818
/// Helper methods for working with <see cref="TokenListParserResult{TKind,T}"/>.

src/Serilog.Expressions/Superpower/Model/TokenListParserResult`2.cs renamed to src/Serilog.Expressions/ParserConstruction/Model/TokenListParserResult`2.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
// limitations under the License.
1414

1515
using System;
16-
using Serilog.Superpower.Display;
17-
using Serilog.Superpower.Util;
16+
using Serilog.ParserConstruction.Display;
17+
using Serilog.ParserConstruction.Util;
1818

19-
namespace Serilog.Superpower.Model
19+
namespace Serilog.ParserConstruction.Model
2020
{
2121
/// <summary>
2222
/// The result of parsing from a token list.

src/Serilog.Expressions/Superpower/Model/TokenList`1.cs renamed to src/Serilog.Expressions/ParserConstruction/Model/TokenList`1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
using System.Collections;
1717
using System.Collections.Generic;
1818

19-
namespace Serilog.Superpower.Model
19+
namespace Serilog.ParserConstruction.Model
2020
{
2121
/// <summary>
2222
/// A list of <see cref="Token{TKind}"/>

src/Serilog.Expressions/Superpower/Model/Token`1.cs renamed to src/Serilog.Expressions/ParserConstruction/Model/Token`1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
namespace Serilog.Superpower.Model
15+
namespace Serilog.ParserConstruction.Model
1616
{
1717
/// <summary>
1818
/// A token.

src/Serilog.Expressions/Superpower/Model/Unit.cs renamed to src/Serilog.Expressions/ParserConstruction/Model/Unit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
namespace Serilog.Superpower.Model
15+
namespace Serilog.ParserConstruction.Model
1616
{
1717
/// <summary>
1818
/// A structure with no information.

src/Serilog.Expressions/Superpower/Parse.cs renamed to src/Serilog.Expressions/ParserConstruction/Parse.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
// limitations under the License.
1414

1515
using System;
16-
using Serilog.Superpower.Display;
17-
using Serilog.Superpower.Model;
18-
using Serilog.Superpower.Util;
16+
using Serilog.ParserConstruction.Display;
17+
using Serilog.ParserConstruction.Model;
18+
using Serilog.ParserConstruction.Util;
1919

20-
namespace Serilog.Superpower
20+
namespace Serilog.ParserConstruction
2121
{
2222
/// <summary>
2323
/// General parsing helper methods.

src/Serilog.Expressions/Superpower/ParseException.cs renamed to src/Serilog.Expressions/ParserConstruction/ParseException.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
// limitations under the License.
1414

1515
using System;
16-
using Serilog.Superpower.Model;
16+
using Serilog.ParserConstruction.Model;
1717

1818
// ReSharper disable IntroduceOptionalParameters.Global, MemberCanBePrivate.Global, UnusedAutoPropertyAccessor.Global
1919

20-
namespace Serilog.Superpower
20+
namespace Serilog.ParserConstruction
2121
{
2222
/// <summary>
2323
/// Represents an error that occurs during parsing.

src/Serilog.Expressions/Superpower/ParserExtensions.cs renamed to src/Serilog.Expressions/ParserConstruction/ParserExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
// limitations under the License.
1414

1515
using System;
16-
using Serilog.Superpower.Model;
16+
using Serilog.ParserConstruction.Model;
1717

18-
namespace Serilog.Superpower
18+
namespace Serilog.ParserConstruction
1919
{
2020
/// <summary>
2121
/// Helper methods for working with parsers.

src/Serilog.Expressions/Superpower/Parsers/Character.cs renamed to src/Serilog.Expressions/ParserConstruction/Parsers/Character.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
// limitations under the License.
1414

1515
using System;
16-
using Serilog.Superpower.Display;
17-
using Serilog.Superpower.Model;
16+
using Serilog.ParserConstruction.Display;
17+
using Serilog.ParserConstruction.Model;
1818

19-
namespace Serilog.Superpower.Parsers
19+
namespace Serilog.ParserConstruction.Parsers
2020
{
2121
/// <summary>
2222
/// Parsers for matching individual characters.

src/Serilog.Expressions/Superpower/Parsers/Numerics.cs renamed to src/Serilog.Expressions/ParserConstruction/Parsers/Numerics.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
using Serilog.Superpower.Model;
16-
using Serilog.Superpower.Util;
15+
using Serilog.ParserConstruction.Model;
16+
using Serilog.ParserConstruction.Util;
1717

18-
namespace Serilog.Superpower.Parsers
18+
namespace Serilog.ParserConstruction.Parsers
1919
{
2020
/// <summary>
2121
/// Parsers for numeric patterns.

src/Serilog.Expressions/Superpower/Parsers/Span.cs renamed to src/Serilog.Expressions/ParserConstruction/Parsers/Span.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
// limitations under the License.
1414

1515
using System;
16-
using Serilog.Superpower.Display;
17-
using Serilog.Superpower.Model;
16+
using Serilog.ParserConstruction.Display;
17+
using Serilog.ParserConstruction.Model;
1818

19-
namespace Serilog.Superpower.Parsers
19+
namespace Serilog.ParserConstruction.Parsers
2020
{
2121
/// <summary>
2222
/// Parsers for spans of characters.

src/Serilog.Expressions/Superpower/Parsers/Token.cs renamed to src/Serilog.Expressions/ParserConstruction/Parsers/Token.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
// limitations under the License.
1414

1515
using System;
16-
using Serilog.Superpower.Display;
17-
using Serilog.Superpower.Model;
16+
using Serilog.ParserConstruction.Display;
17+
using Serilog.ParserConstruction.Model;
1818

19-
namespace Serilog.Superpower.Parsers
19+
namespace Serilog.ParserConstruction.Parsers
2020
{
2121
/// <summary>
2222
/// Parsers for matching individual tokens.

src/Serilog.Expressions/Superpower/TextParser`1.cs renamed to src/Serilog.Expressions/ParserConstruction/TextParser`1.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
using Serilog.Superpower.Model;
15+
using Serilog.ParserConstruction.Model;
1616

17-
namespace Serilog.Superpower
17+
namespace Serilog.ParserConstruction
1818
{
1919
/// <summary>
2020
/// A parser that consumes text from a string span.

src/Serilog.Expressions/Superpower/TokenListParser`2.cs renamed to src/Serilog.Expressions/ParserConstruction/TokenListParser`2.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
using Serilog.Superpower.Model;
15+
using Serilog.ParserConstruction.Model;
1616

17-
namespace Serilog.Superpower
17+
namespace Serilog.ParserConstruction
1818
{
1919
/// <summary>
2020
/// A parser that consumes elements from a list of tokens.

src/Serilog.Expressions/Superpower/Tokenizer`1.cs renamed to src/Serilog.Expressions/ParserConstruction/Tokenizer`1.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
using System;
1616
using System.Collections.Generic;
17-
using Serilog.Superpower.Display;
18-
using Serilog.Superpower.Model;
17+
using Serilog.ParserConstruction.Display;
18+
using Serilog.ParserConstruction.Model;
1919

20-
namespace Serilog.Superpower
20+
namespace Serilog.ParserConstruction
2121
{
2222
/// <summary>
2323
/// Base class for tokenizers, types whose instances convert strings into lists of tokens.

src/Serilog.Expressions/Superpower/Util/ArrayEnumerable.cs renamed to src/Serilog.Expressions/ParserConstruction/Util/ArrayEnumerable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
using System.Runtime.CompilerServices;
1616

17-
namespace Serilog.Superpower.Util
17+
namespace Serilog.ParserConstruction.Util
1818
{
1919
static class ArrayEnumerable
2020
{

src/Serilog.Expressions/Superpower/Util/CharInfo.cs renamed to src/Serilog.Expressions/ParserConstruction/Util/CharInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
namespace Serilog.Superpower.Util
15+
namespace Serilog.ParserConstruction.Util
1616
{
1717
static class CharInfo
1818
{

src/Serilog.Expressions/Superpower/Util/Friendly.cs renamed to src/Serilog.Expressions/ParserConstruction/Util/Friendly.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
using System.Collections.Generic;
1717
using System.Linq;
1818

19-
namespace Serilog.Superpower.Util
19+
namespace Serilog.ParserConstruction.Util
2020
{
2121
static class Friendly
2222
{

0 commit comments

Comments
 (0)