Skip to content

Commit

Permalink
Fix unicode plugin parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
0x89A authored and austinv900 committed Sep 10, 2023
1 parent 7369c5c commit 1e8a05c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/CSharp/CSharpLanguage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,12 @@ private async Task<CompilerMessage> SafeCompile(CompilerData data, CompilerMessa
foreach (var source in data.SourceFiles)
{
string fileName = Path.GetFileName(source.Name);

bool isUnicode = false;
string sourceString = Regex.Replace(encoding.GetString(source.Data), @"\\[uU]([0-9A-F]{4})", match =>
{
isUnicode = true;
return ((char)int.Parse(match.Value.Substring(2), NumberStyles.HexNumber)).ToString();
});
}, RegexOptions.Compiled | RegexOptions.IgnoreCase);

SyntaxTree tree = CSharpSyntaxTree.ParseText(sourceString, options, path: fileName, encoding: encoding, cancellationToken: _token);
trees.Add(source, tree);
Expand Down

0 comments on commit 1e8a05c

Please sign in to comment.