提交 abb86704 编写于 作者: C Cyrus Najmabadi

Fix comment. Also support lang=regex

上级 137474b8
...@@ -40,7 +40,7 @@ internal sealed class RegexPatternDetector ...@@ -40,7 +40,7 @@ internal sealed class RegexPatternDetector
/// Option names are the values from the <see cref="RegexOptions"/> enum. /// Option names are the values from the <see cref="RegexOptions"/> enum.
/// </summary> /// </summary>
private static readonly Regex s_languageCommentDetector = private static readonly Regex s_languageCommentDetector =
new Regex(@"language\s*=\s*regex(p)?((\s*,\s*)(?<option>[a-zA-Z]+))*", new Regex(@"lang(uage)?\s*=\s*regex(p)?((\s*,\s*)(?<option>[a-zA-Z]+))*",
RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Dictionary<string, RegexOptions> s_nameToOption = private static readonly Dictionary<string, RegexOptions> s_nameToOption =
...@@ -89,9 +89,6 @@ internal sealed class RegexPatternDetector ...@@ -89,9 +89,6 @@ internal sealed class RegexPatternDetector
public static bool IsDefinitelyNotPattern(SyntaxToken token, ISyntaxFactsService syntaxFacts) public static bool IsDefinitelyNotPattern(SyntaxToken token, ISyntaxFactsService syntaxFacts)
{ {
// We only support string literals passed in arguments to something.
// In the future we could support any string literal, as long as it has
// some marker (like a comment on it) stating it's a regex.
if (!syntaxFacts.IsStringLiteral(token)) if (!syntaxFacts.IsStringLiteral(token))
{ {
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册