Add support for named group predicates (as in (?(open)...))

This is necessary to support balanced group regular expressions.
The new 'numberOfCaptures' regular expression now will not count
such predicate as a capture group.
This commit is contained in:
Daan 2013-05-11 16:42:57 -07:00
Родитель b851a1b963
Коммит 7d4b7161c2
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -11,7 +11,7 @@ namespace ColorCode.Compilation
{
public class LanguageCompiler : ILanguageCompiler
{
private static readonly Regex numberOfCapturesRegex = new Regex(@"(?x)(?<!\\)\((?!\?)", RegexOptions.Compiled);
private static readonly Regex numberOfCapturesRegex = new Regex(@"(?x)(?<!(\\|(?!\\)\(\?))\((?!\?)", RegexOptions.Compiled);
private readonly Dictionary<string, CompiledLanguage> compiledLanguages;
private readonly ReaderWriterLockSlim compileLock;