Skip to content

Commit

Permalink
Replace range operators with Substring method for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
hogimn committed Sep 26, 2024
1 parent e0dd510 commit 01b81b6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions SQL.Formatter/Core/Tokenizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public JSLikeList<Token> Tokenize(string input)
if (!string.IsNullOrEmpty(input))
{
token = GetNextToken(input, token);
input = input[token.Value.Length..];
input = input.Substring(token.Value.Length);
tokens.Add(token.WithWhitespaceBefore(whitespaceBefore));
}
}
Expand All @@ -101,7 +101,7 @@ public JSLikeList<Token> Tokenize(string input)
private static string[] FindBeforeWhitespace(string input)
{
var index = input.TakeWhile(char.IsWhiteSpace).Count();
return new[] { input[..index], input[index..] };
return new[] { input.Substring(0, index), input.Substring(index) };
}

private Token GetNextToken(string input, Token previousToken)
Expand Down Expand Up @@ -161,7 +161,7 @@ private Token GetPlaceholderToken(string input)
private Token GetIdentNamedPlaceholderToken(string input)
{
return GetPlaceholderTokenWithKey(
input, _indentNamedPlaceholderPattern, v => v[1..]);
input, _indentNamedPlaceholderPattern, v => v.Substring(1));
}

private Token GetStringNamedPlaceholderToken(string input)
Expand All @@ -170,13 +170,13 @@ private Token GetStringNamedPlaceholderToken(string input)
input,
_stringNamedPlaceholderPattern,
v => GetEscapedPlaceholderKey(
v[2..^1], v[^1..]));
v.Substring(2, v.Length - 3), v.Substring(v.Length - 1)));
}

private Token GetIndexedPlaceholderToken(string input)
{
return GetPlaceholderTokenWithKey(
input, _indexedPlaceholderPattern, v => v[1..]);
input, _indexedPlaceholderPattern, v => v.Substring(1));
}

private static Token GetPlaceholderTokenWithKey(string input, Regex regex, Func<string, string> parseKey)
Expand Down

0 comments on commit 01b81b6

Please sign in to comment.