func (p *Parser) Parse() *html.Node {
	htmlNode := &html.Node{Type: html.NodeElement, Tag: "html"}
	head := &html.Node{Type: html.NodeElement, Tag: "head"}
	body := &html.Node{Type: html.NodeElement, Tag: "body"}
	n := p.parseNode()
	if n == nil {
		return nil
	}
	if n.Type == html.NodeElement && n.Tag == "html" {
		htmlNode = n
	}
	if n.Type == html.NodeElement && n.Tag == "head" {
		head = n
		n = p.parseNode()
	}
	htmlNode.AddChild(head)
	if n.Type == html.NodeElement && n.Tag == "body" {
		body = n
		n = p.parseNode()
	}
	htmlNode.AddChild(body)
	for n != nil {
		body.AddChild(n)
		n = p.parseNode()
	}
	return htmlNode
}
Parse parses the document and return a html.tree.
Before using node check for parser error with Errors.
package parser
import (
	"fmt"
	"github.com/lysrt/bro/html"
	"github.com/lysrt/bro/html/lexer"
)
const nodeClosingElement html.NodeType = "closing element"
type Error struct {
	Token lexer.Token
	Msg   string
}
func (e Error) Error() string {
	return e.Msg
}
type Parser struct {
	l *lexer.Lexer
	curToken  lexer.Token
	peekToken lexer.Token
	elements []*html.Node
	errors []Error
}
func New(l *lexer.Lexer) *Parser {
	p := &Parser{
		l:      l,
		errors: []Error{},
	}
	p.nextToken()
	p.nextToken()
	return p
}
func (p *Parser) Errors() []Error {
	return p.errors
}
func (p *Parser) nextToken() {
	p.curToken = p.peekToken
	p.peekToken = p.l.NextToken()
}