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

Unified Parser #40

Open
futursolo opened this issue Sep 12, 2021 · 1 comment
Open

Unified Parser #40

futursolo opened this issue Sep 12, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request epic
Projects

Comments

@futursolo
Copy link
Owner

futursolo commented Sep 12, 2021

This issue aims to implement a unified parser that replaces nom and syn::parse:

  1. Accepts both proc_macro2::TokenStream and String as input
  2. Preserves location information in both proc_macro2::Span and string cursor
  3. Emits a custom format with nice error message for string literal and native compile_error! for proc_macro2::TokenStream

Minimum Requirement:

  1. When runtime parser is enabled, it needs to be not bigger than current nom based parser (~70KB before gzipped)
  2. Passes all test cases (feature parity)

Good to Have:

  1. Performance (whilst some performance degradation is acceptable / expected (due to more intermediate steps), the new parser should still have solid performance)
  2. Advanced Diagnostic Information / parser tolerance (The parser should either tolerant any error (like browser) or provide helpful diagnostic information when encountering an error)

Flow: Input(String or proc_macro2::TokenStream) -> Tokenise(stylist::parser::TokenStream) -> Parse(stylist::parser::ast) -> Output(stylist::ast)

There's no ETA for this issue and it will land when the work completes.

@futursolo futursolo added enhancement New feature or request epic labels Sep 12, 2021
@futursolo futursolo self-assigned this Sep 12, 2021
@futursolo futursolo added this to To do in v0.11.0 Sep 17, 2021
@futursolo futursolo moved this from To do to In progress in v0.11.0 Sep 18, 2021
@futursolo
Copy link
Owner Author

In addition, with the new parser only rely on std and arcstr(which maybe removed if a customised ArcStr is smaller) when parsing string literals, I think it makes sense to make parser available to everyone for debug_assertions in Style and GlobalStyle in debug mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request epic
Projects
v0.11.0
  
In progress
Development

No branches or pull requests

1 participant