示例#1
0
 public override void CreateSyntax(Tree.Component owner, MarkdownLexer.Token reference, CreateSyntaxResult result)
 {
     if (reference is MarkdownLexer.NewLine)
     {
         new NewLine(owner, reference, reference);
     }
 }
示例#2
0
 public override void CreateSyntax(Tree.Component owner, Tree.Syntax reference, CreateSyntaxResult result)
 {
     if (reference is MarkdownLexer.FileText referenceFileText)
     {
         var page = new Page((Document)owner, referenceFileText);
         result.CreateSyntaxTree(page, reference.NextAll);
     }
 }
示例#3
0
 public override void CreateSyntax(Tree.Component owner, Tree.Syntax reference, CreateSyntaxResult result)
 {
     if (reference is Storage.FileText referenceFileText)
     {
         var fileText = new FileText((Document)owner, referenceFileText);
         result.CreateSyntaxTree(fileText, reference.NextAll);
     }
 }
示例#4
0
 public override void CreateSyntax(Tree.Component owner, MarkdownLexer.Token reference, CreateSyntaxResult result)
 {
     if (owner.Last is Content content)
     {
         content.Remove();
         new Content(owner, content.ReferenceBegin, reference);
     }
     else
     {
         new Content(owner, reference, reference);
     }
 }
示例#5
0
 public override void CreateSyntax(Tree.Component owner, MarkdownLexer.Token reference, CreateSyntaxResult result)
 {
     if (reference is MarkdownLexer.Header tokenHeader)
     {
         // Previous
         bool isNull    = tokenHeader.Previous == null;
         bool isSpace   = tokenHeader.Previous is MarkdownLexer.Space && (tokenHeader.Previous.Previous == null || tokenHeader.Previous.Previous is MarkdownLexer.NewLine);
         bool isNewLine = tokenHeader.Previous is MarkdownLexer.NewLine;
         if (isNull || isSpace || isNewLine)
         {
             var header = new Header(owner, reference);
             result.CreateSyntaxTree(header, reference.Next, SyntaxFactoryStopList());
         }
     }
 }
示例#6
0
 public override void CreateSyntax(Tree.Component owner, MarkdownLexer.Token reference, CreateSyntaxResult result)
 {
     if (reference is MarkdownLexer.Comment comment && comment.IsEnd == false)
     {
         MarkdownLexer.Token referenceNext = reference;
         while ((referenceNext = referenceNext.Next) != null)
         {
             if (referenceNext is MarkdownLexer.Comment commentNext && commentNext.IsEnd)
             {
                 new Comment(owner, reference, referenceNext);
                 break;
             }
         }
     }
 }
示例#7
0
 public override void CreateSyntax(Tree.Component owner, MarkdownLexer.Token reference, CreateSyntaxResult result)
 {
     if (reference is MarkdownLexer.Special specialOpen && specialOpen.Text == "[")
     {
         if (reference.Next is MarkdownLexer.Content contentLinkUrl)
         {
             if (reference.Next?.Next is MarkdownLexer.Special specialClose && specialClose.Text == "]")
             {
                 if (reference.Next?.Next?.Next is MarkdownLexer.Special specialOpen2 && specialOpen2.Text == "(")
                 {
                     if (reference.Next?.Next?.Next?.Next is MarkdownLexer.Content contentLinkText)
                     {
                         if (reference.Next?.Next?.Next?.Next?.Next is MarkdownLexer.Special specialClose2 && specialClose2.Text == ")")
                         {
                             new Link(owner, reference, specialClose2, LinkUrl, LinkText);
                         }
                     }
                 }
             }
         }
     }
 }
示例#8
0
 public Comment(Tree.Component owner, MarkdownLexer.Token referenceBegin, MarkdownLexer.Token referenceEnd)
     : base(owner, referenceBegin, referenceEnd)
 {
 }
示例#9
0
 public virtual void CreateSyntax(Tree.Component owner, MarkdownLexer.Token reference, CreateSyntaxResult result)
 {
 }
示例#10
0
 public override void CreateSyntax(Tree.Component owner, Tree.Syntax reference, CreateSyntaxResult result)
 {
     CreateSyntax(owner, (MarkdownLexer.Token)reference, result);
 }
示例#11
0
 public Node(Tree.Component owner, MarkdownLexer.Token reference)
     : base(owner, reference)
 {
 }
示例#12
0
 public override void CreateSyntax(Tree.Component owner, Tree.Syntax reference, CreateSyntaxResult result)
 {
     CreateSyntax((FileText)owner, (Storage.Character)reference, result);
 }
示例#13
0
 public Link(Tree.Component owner, MarkdownLexer.Token referenceBegin, MarkdownLexer.Token referenceEnd, MarkdownLexer.Content linkUrl, MarkdownLexer.Content linkText)
     : base(owner, referenceBegin, referenceEnd)
 {
     LinkUrl  = linkUrl;
     LinkText = linkText;
 }