Exemple #1
0
        public void TestStarred()
        {
            var expected = new StarRegex <int>(123.ToRegex());
            var actual   = 123.ToRegex().Starred();

            Assert.AreEqual(expected, actual);
        }
        public void AtomAndStar()
        {
            const string input    = "a*";
            var          expected = new StarRegex <char>(new AtomicRegex <char>('a'));
            var          actual   = this.converter.Convert(input);

            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        private Regex ParseWithoutSumAndCatenation()
        {
            var alreadyParsedBackup = this.alreadyParsed;

            try
            {
                var result = this.ParseWithoutSumCatenationAndStar();
                while (this.Accept(typeof(StarToken)))
                {
                    result = new StarRegex <char>(result);
                }

                return(result);
            }
            catch (RegexParserInternalException)
            {
                this.alreadyParsed = alreadyParsedBackup;
                throw;
            }
        }