gosub-io / gosub-engine

Our main browser engine repository.

Home Page:https://gosub.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

there is still an issue where the tokenizer needs to call the parser

jaytaph opened this issue · comments

there is still an issue where the tokenizer needs to call the parser (i needs to know the namespace of the adjusted current node).. connecting the parser back to the tokenizer will create a cyclic dependency and makes this very hard to get right with the borrow checker. This I think is one of the reasons many implementations of a html5parser will actually have 3 actors: the tokenizer, the parser and a tree-builder (or treesink). Here, the parser will tell the tree-builder to add / retrieve nodes, and the tokenizer can ask the tree-builder for some additional information.

Now, in order to not completely rewrite the parser (yet).. i opt for just adding the information (the adjusted-current-node's namespace) to the tokenizer call in the parser. This is a bit of an ugly hack, but it works for now, since we know that no other data from the parser is needed, and it saves a lot of time rewriting the parser.

Originally posted by @jaytaph in #182 (reply in thread)

This links to #369