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

Rust expressions in attribute levels can conflict with custom attribute syntax #46

Open
vldm opened this issue Jan 16, 2024 · 0 comments

Comments

@vldm
Copy link
Collaborator

vldm commented Jan 16, 2024

In #8 i propose to use any array of puncts as modifiers to props and store them as prefix and postfix to attribute name.

Implementing this can be tricky, since some of puncts prefixes can be treated as part of expression in previos attribute value.

Example:

<div foo=bar .baz />

This example can be parsed as div with one attribute foo with value bar.baz, or as div with two attributes foo=bar and .baz.

To avoid this conflcits, i propose to have a flag in ParserConfig that will enforce users to use some limited form of expressions in value place.

Some values that is known to have no conflict during parsing:

  1. Literals "foo", 'c', 123, 0x123, 0.1f32
  2. Expressions in braces/parens (x+1), {foo.bar}, [1..2], [1u8;32]
  3. simple variable as value foo
  4. async/try/const blocks async {...}, const {...}
  5. Any form of closures with rules 1-2 aplied to thier body. move || "foo", |foo|->Bar {foo.bar}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant