Use nullable

This commit is contained in:
Alexey Golub
2019-11-13 19:19:36 +02:00
parent 1bf9d9e2e2
commit e5a2852165
42 changed files with 195 additions and 196 deletions

View File

@@ -16,9 +16,9 @@ namespace DiscordChatExporter.Core.Markdown.Internal
{
}
public ParsedMatch<T> Match(StringPart stringPart)
public ParsedMatch<T>? Match(StringPart stringPart)
{
ParsedMatch<T> earliestMatch = null;
ParsedMatch<T>? earliestMatch = null;
// Try to match the input with each matcher and get the match with the lowest start index
foreach (var matcher in _matchers)

View File

@@ -2,6 +2,6 @@
{
internal interface IMatcher<T>
{
ParsedMatch<T> Match(StringPart stringPart);
ParsedMatch<T>? Match(StringPart stringPart);
}
}

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text.RegularExpressions;
namespace DiscordChatExporter.Core.Markdown.Internal
@@ -23,7 +19,7 @@ namespace DiscordChatExporter.Core.Markdown.Internal
{
}
public ParsedMatch<T> Match(StringPart stringPart)
public ParsedMatch<T>? Match(StringPart stringPart)
{
var match = _regex.Match(stringPart.Target, stringPart.StartIndex, stringPart.Length);
if (!match.Success)

View File

@@ -20,7 +20,7 @@ namespace DiscordChatExporter.Core.Markdown.Internal
{
}
public ParsedMatch<T> Match(StringPart stringPart)
public ParsedMatch<T>? Match(StringPart stringPart)
{
var index = stringPart.Target.IndexOf(_needle, stringPart.StartIndex, stringPart.Length, _comparison);