Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 5e68824

Browse files
committed
fixed reformat broken with escaped backslashes between single quotes
1 parent 58b94ec commit 5e68824

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

Utils/SPSyntaxTidy/SPTokenizer.cs

+2-30
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static SPToken[] Tokenize(string source)
4343

4444
#region Quotes
4545

46-
if (c == '"')
46+
if (c == '"' || c == '\'')
4747
{
4848
var startIndex = i;
4949
var foundOccurence = false;
@@ -52,7 +52,7 @@ public static SPToken[] Tokenize(string source)
5252
for (var j = i + 1; j < length; ++j)
5353
{
5454
// if found, search for an escape slash before it
55-
if (buffer[j] == '"')
55+
if (buffer[j] == c)
5656
{
5757
if (buffer[j - 1] == '\\')
5858
{
@@ -112,34 +112,6 @@ public static SPToken[] Tokenize(string source)
112112
continue;
113113
}
114114

115-
if (c == '\'') //I sell that as a quote...kill me right?
116-
{
117-
var startIndex = i;
118-
var foundOccurence = false;
119-
for (var j = i + 1; j < length; ++j)
120-
{
121-
if (buffer[j] == '\'')
122-
{
123-
if (buffer[j - 1] != '\\') //is the quote not escaped?
124-
{
125-
token.Add(new SPToken()
126-
{
127-
Kind = SPTokenKind.Quote,
128-
Value = source.Substring(startIndex, j - startIndex + 1)
129-
});
130-
foundOccurence = true;
131-
i = j;
132-
break;
133-
}
134-
}
135-
}
136-
137-
if (foundOccurence)
138-
{
139-
continue;
140-
}
141-
}
142-
143115
#endregion
144116

145117
#region Comments

0 commit comments

Comments
 (0)