Example #1
0
        public Tokenizer(TokenizerContext context, bool ignoreWhitespace)
        {
            string whitespaceDelimiter = ignoreWhitespace ? @"\s*" : @"";

            Context = context;
            Rule    = new Regex($@"{whitespaceDelimiter}(?:{
                    string.Join(@"|", Context.Select(tokenResource => $@"({
                        string.Join(@"|", tokenResource.RegexPatterns.Select(tokenPattern => $@"(?:{tokenPattern})"))
                        })"))
                    }|(.)){whitespaceDelimiter}", RegexOptions.Compiled);
        }
Example #2
0
 public Tokenizer(TokenizerContext context)
     : this(context, true)
 {
 }