public void TextTest()
        {
            const string txt = "text ``string`post-text string";

            using (var scan = new CompactProfileScanner(txt))
            {
                Assert.AreEqual("text `string", scan.ScanText());
                Assert.AreEqual("p", scan.Current.ToString(CultureInfo.InvariantCulture), "Should now be beyond the delimeter");
            }
        }
Ejemplo n.º 2
0
        internal void ScanPartialBody(int classId, GenSegBody body, GenContainerFragmentBase parentContainer, ContainerFragment containerFragment, out TokenType t)
        {
            FragmentBody = IsPrimary ? containerFragment.Body() : containerFragment.SecondaryBody();
            GenTextBlock textBlock = null;
            var          s         = Scan.ScanText();

            if (Scan.Eof)
            {
                if (s.Length > 0)
                {
                    GenCompactProfileParser.AddText(parentContainer, FragmentBody, ref textBlock, s, GenDataDef, IsPrimary);
                }
                t = TokenType.Unknown;
                return;
            }

            if (s.Length > 0)
            {
                GenCompactProfileParser.AddText(parentContainer, FragmentBody, ref textBlock, s, GenDataDef, IsPrimary);
            }

            t = Scan.ScanTokenType();
            while (!Scan.Eof && t != TokenType.Close && t != TokenType.Secondary && t != TokenType.Unknown)
            {
                if (t != TokenType.Name && textBlock != null)
                {
                    textBlock = null;
                }
                var frag = GenCompactProfileParser.ScanFragment(classId, ref t, out s, parentContainer, FragmentBody, ref textBlock, IsPrimary);
                if (t != TokenType.Name)
                {
                    AddFragment(body, frag);
                }
                if (s.Length > 0)
                {
                    GenCompactProfileParser.AddText(parentContainer, FragmentBody, ref textBlock, s, GenDataDef, IsPrimary);
                }
                t = Scan.ScanTokenType();
            }
        }