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

feat(parser): add very experimental vue template syntax to html grammar #3369

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dyc3
Copy link
Contributor

@dyc3 dyc3 commented Jul 7, 2024

Summary

This PR aims to explore how an HTML-ish language, specifically Vue, could be implemented. The ultimate goal is to be able to format and create lint rules for Vue.

I think it makes the most sense to eventually add HtmlParseOptions, and be able to conditionally parse Vue's syntax nodes.

Discussion: #1726

Test Plan

Currently, it's broken. The generated code causes the html parser to not be able to compile anymore for multiple reasons.

The first most obvious problem is how the {{ }} interpolation syntax is handled. The code gen seems to create 2 l_curly_token entries on the struct, which is invalid rust, and also not the right token. It should be l_double_curly_token.

The second problem is that the new syntax nodes aren't getting added to HtmlSyntaxKind. No idea what the source of that would be. Added nodes to html_kinds_src.rs

I've managed to fix all the codegen issues.

@github-actions github-actions bot added the A-Tooling Area: internal tools label Jul 7, 2024
@dyc3 dyc3 force-pushed the 07-07-vue_template_parser branch 2 times, most recently from 7f7c5bc to e7a1a84 Compare July 7, 2024 17:40
@denbezrukov
Copy link
Contributor

Thank you for starting to progress the tasks!

Just to clarify, I thought we wanted to have a separate grammar for each HTML-like language and share the same logic via traits?

@dyc3
Copy link
Contributor Author

dyc3 commented Jul 7, 2024

I'm currently just experimenting to see how this approach turns out. I want to get a better feel for some of the parser/codegen gotchas. Tbh, I can't really visualize how the trait based approach would work right now, so I'm attempting to get a better feel for this area of the codebase.

@dyc3 dyc3 force-pushed the 07-07-vue_template_parser branch from e7a1a84 to c9e6d9b Compare July 7, 2024 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Tooling Area: internal tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants