Skip to content

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

@vldm

Description

@vldm

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}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions