fixed some bugs
This commit is contained in:
parent
890166ebce
commit
7353cbcd49
@ -75,7 +75,7 @@ internal static partial class Modes
|
||||
ColoredConsole.Write("Input file path: ", ConsoleColor.Blue);
|
||||
input = ColoredConsole.ReadLine(ConsoleColor.Gray);
|
||||
if (string.IsNullOrEmpty(input))
|
||||
throw new NullReferenceException();
|
||||
throw new ArgumentException("Input file path is required");
|
||||
inputPath = input;
|
||||
break;
|
||||
|
||||
@ -83,9 +83,9 @@ internal static partial class Modes
|
||||
case "output":
|
||||
ColoredConsole.Write("Output file path [default=stdout]: ", ConsoleColor.Blue);
|
||||
input = ColoredConsole.ReadLine(ConsoleColor.Gray);
|
||||
if (string.IsNullOrEmpty(input))
|
||||
throw new ArgumentException("Input file path is required");
|
||||
inputPath = input;
|
||||
if(string.IsNullOrEmpty(input))
|
||||
outputPath = null;
|
||||
else outputPath = input;
|
||||
break;
|
||||
|
||||
case "s":
|
||||
|
||||
@ -41,7 +41,8 @@ public static class SearchExpressionCompiler
|
||||
var subExprs = new List<ISearchExpression>();
|
||||
int supExprBegin = 1;
|
||||
int bracketBalance = 1;
|
||||
for (int i = supExprBegin; i < query.Length && bracketBalance != 0; i++)
|
||||
int i = supExprBegin;
|
||||
for (; i < query.Length && bracketBalance != 0; i++)
|
||||
{
|
||||
if (CharEqualsAndNotEscaped('(', query, i))
|
||||
{
|
||||
@ -60,7 +61,7 @@ public static class SearchExpressionCompiler
|
||||
}
|
||||
}
|
||||
|
||||
if (query[^1] != ')')
|
||||
if (i != query.Length)
|
||||
throw new NotImplementedException("Expressions after ')' are not supported");
|
||||
|
||||
if (bracketBalance > 0)
|
||||
@ -68,7 +69,7 @@ public static class SearchExpressionCompiler
|
||||
if (bracketBalance < 0)
|
||||
throw new Exception("Too many closing brackets");
|
||||
|
||||
var subPartLast = query.Slice(supExprBegin, query.Length - supExprBegin - 1);
|
||||
var subPartLast = query.Slice(supExprBegin, i - 1 - supExprBegin);
|
||||
var subExprLast = Compile(subPartLast);
|
||||
subExprs.Add(subExprLast);
|
||||
return new MultipleMatchExpression(subExprs);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user