Example #1
0
        public void ImplicitCommentSkip()
        {
            var tp = new TestParser();

            tp.SetContext(";/*/hidden/*/first x/**/second");
            tp.IndexPlus(2);
            tp.ExpectName("first");
            tp.IndexPlus(2);
            tp.ExpectName("second");
        }
Example #2
0
        public void GetNumber()
        {
            var tp = new TestParser();

            tp.SetContext("  1 1.5/*test*/.5 0.123 1234 -.5 -12 . ", 0);
            tp.ExpectNumber("1");
            tp.ExpectNumber("1.5");
            tp.ExpectNumber("0.5");
            tp.ExpectNumber("0.123");
            tp.ExpectNumber("1234");
            tp.ExpectNumber("-0.5");
            tp.ExpectNumber("-12");
            tp.ExpectNumber(null);

            tp = new TestParser();
            tp.SetContext("-", 0);
            tp.ExpectNumber(null);

            tp = new TestParser();
            tp.SetContext("12.5.1", 0);
            tp.ExpectNumber("12.5");

            tp = new TestParser();
            tp.SetContext("-x", 0);
            tp.ExpectNumber(null);
            tp.ExpectName("-x");
        }
Example #3
0
        public void GetWord()
        {
            var tp = new TestParser();

            tp.SetContext("  hello -bingo _toto hou-hou u2 -x -100px");
            tp.ExpectName("hello");
            tp.ExpectName("-bingo");
            tp.ExpectName("_toto");
            tp.ExpectName("hou-hou");
            tp.ExpectName("u2");
            tp.ExpectName("-x");
            tp.ExpectName(null);

            tp.SetContext("hello]");
            tp.ExpectName("hello");
            tp.ExpectName(null);
        }