Ejemplo n.º 1
0
        static void AnotherTestCase()
        {
            ScannerInfo       info   = new ScannerInfo();
            RegularExpression regex1 = new RegularExpression();

            regex1.DefineLiteral("string");
        }
Ejemplo n.º 2
0
        public static RegularExpression CreateWithLiteral(string input)
        {
            RegularExpression r = new RegularExpression();

            r.DefineLiteral(input);
            return(r);
        }
Ejemplo n.º 3
0
        static void Testcase()
        {
            ScannerInfo info = new ScannerInfo();

            RegularExpression regex1 = new RegularExpression();

            regex1.DefineLiteral("string");
            regex1.Describtion = "string key word";

            RegularExpression regex = new RegularExpression();

            regex.Describtion = "string with no number";
            regex.DefineLiteral("\"");
            regex.Concat(RegularExpression.DefineRange('a', 'z').Union(RegularExpression.DefineRange('A', 'Z')).KleeneStar()).Concat(RegularExpression.CreateWithLiteral("\""));

            RegularExpression regex2 = RegularExpression.CreateWithLiteral(" ");

            regex2.Describtion = "white space";

            info.AddRegex(regex2);
            info.AddRegex(regex1);
            info.AddRegex(regex);

            info.GenerateData();
            Scanner scanner = new Scanner(info);

            scanner.SetSkipTokenRegex(regex2);
            scanner.SetSource("\"adad\" string");
            var t = scanner.ReadAll();

            Console.WriteLine(/*t.Describtion*/ t);
        }