| 12345678910111213141516171819202122232425262728293031323334 |
- using Larkdown.Parser.Ast;
- using Larkdown.Parser.Lexer;
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Larkdown.Parser
- {
- public class Parser
- {
- public Parser()
- {
- }
- public Ast.Ast Parse(string source)
- {
- var ast = new Ast.Ast();
- var lexer = new Lexer.Lexer(source);
- var node = new ParagraphNode();
- foreach (var token in lexer.Tokens())
- {
- if (token.Type == TokenType.Text)
- {
- node.AddText(token.Content);
- }
- }
- ast.Add(node);
- return ast;
- }
- }
- }
|