Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jaytaph opened this issue Nov 5, 2023 · 1 comment
Open
Labels
html5 parser Any issues related to the HTML5 parser html5 tokenizer Any issues related to the HTML5 tokenizer html5 Any issues related to HTML5

Comments

@jaytaph
Copy link
Member

jaytaph commented Nov 5, 2023

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)

@jaytaph jaytaph changed the title 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. there is still an issue where the tokenizer needs to call the parser Nov 5, 2023
@Kiyoshika Kiyoshika added html5 parser Any issues related to the HTML5 parser html5 tokenizer Any issues related to the HTML5 tokenizer html5 Any issues related to HTML5 labels Dec 2, 2023
@jaytaph
Copy link
Member Author

jaytaph commented Feb 21, 2024

This links to #369

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
html5 parser Any issues related to the HTML5 parser html5 tokenizer Any issues related to the HTML5 tokenizer html5 Any issues related to HTML5
Projects
None yet
Development

No branches or pull requests

2 participants