提交 956f4dce 编写于 作者: C Cyrus Najmabadi

Report issues with strings.

上级 7787534c
...@@ -3790,7 +3790,9 @@ public void TestMultiLineString2() ...@@ -3790,7 +3790,9 @@ public void TestMultiLineString2()
</CompilationUnit> </CompilationUnit>
</Tree>", </Tree>",
@"", @"",
@""); @"<Diagnostics>
<Diagnostic Message=""Illegal string character"" Start=""13"" Length=""1"" />
</Diagnostics>");
} }
[Fact] [Fact]
......
...@@ -224,11 +224,22 @@ private struct StrictSyntaxChecker ...@@ -224,11 +224,22 @@ private struct StrictSyntaxChecker
private JsonDiagnostic? CheckString(JsonToken literalToken) private JsonDiagnostic? CheckString(JsonToken literalToken)
{ {
if (literalToken.VirtualChars[0].Char == '\'') var chars = literalToken.VirtualChars;
if (chars[0].Char == '\'')
{ {
return new JsonDiagnostic( return new JsonDiagnostic(
WorkspacesResources.Strings_must_start_with_double_quote_not_single_quote, WorkspacesResources.Strings_must_start_with_double_quote_not_single_quote,
literalToken.VirtualChars[0].Span); chars[0].Span);
}
for (int i = 1, n = chars.Length - 1; i < n; i++)
{
if (chars[i].Char < ' ')
{
return new JsonDiagnostic(
WorkspacesResources.Illegal_string_character,
chars[i].Span);
}
} }
return CheckToken(literalToken); return CheckToken(literalToken);
......
...@@ -863,6 +863,15 @@ internal class WorkspacesResources { ...@@ -863,6 +863,15 @@ internal class WorkspacesResources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Illegal string character.
/// </summary>
internal static string Illegal_string_character {
get {
return ResourceManager.GetString("Illegal_string_character", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Illegal whitespace character. /// Looks up a localized string similar to Illegal whitespace character.
/// </summary> /// </summary>
......
...@@ -751,6 +751,9 @@ ...@@ -751,6 +751,9 @@
<data name="Constructors_not_allowed" xml:space="preserve"> <data name="Constructors_not_allowed" xml:space="preserve">
<value>Constructors not allowed</value> <value>Constructors not allowed</value>
</data> </data>
<data name="Illegal_string_character" xml:space="preserve">
<value>Illegal string character</value>
</data>
<data name="Illegal_whitespace_character" xml:space="preserve"> <data name="Illegal_whitespace_character" xml:space="preserve">
<value>Illegal whitespace character</value> <value>Illegal whitespace character</value>
</data> </data>
......
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
...@@ -1067,6 +1067,11 @@ ...@@ -1067,6 +1067,11 @@
<target state="new">Properties not allowed in an array</target> <target state="new">Properties not allowed in an array</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="Illegal_string_character">
<source>Illegal string character</source>
<target state="new">Illegal string character</target>
<note />
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册