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

Output ambiguity #12

Open
diervo opened this issue Apr 28, 2017 · 3 comments
Open

Output ambiguity #12

diervo opened this issue Apr 28, 2017 · 3 comments

Comments

@diervo
Copy link

diervo commented Apr 28, 2017

@inikulin An interesting though:

Input:

    <input value={foo}/>
    <input value="{foo}/">

    <div title={x}></div>
    <div title="{x}"></div>

Output:

    <input value="{foo}/">
    <input value="{foo}/">

    <div title="{x}"></div>
    <div title="{x}"></div>

Although the transformation is correct from a spec perspective, it generates a little bit of ambiguity from a developer semantics perspective.

How do you feel about adding some metadata to the AttributeNode (which we collect already as we generate tokens) such as for this example valueState: single-quotes|double-quotes|unquoted

I think via location you could potentially figure out, but is not really straight forward tough.

@diervo diervo changed the title Weird parsing transform Output ambiguity Apr 28, 2017
@inikulin
Copy link
Member

inikulin commented May 4, 2017

I'm not sure I understand what's ambiguous here. Can you elaborate, please?

@diervo
Copy link
Author

diervo commented May 4, 2017

In the first example:

 <input value={foo}/>
 <input value="{foo}/">

From an AST perspective what you get in both case is exactly the same (attributeValue="{foo}/"). It will be great to have some extra metadata in the AST Node, so we could build some extra semantics on top (quoted value vs. unquoted)

For example, imagine we want to error out in any attributeValue that is non quoted. At the AST level we won't know if you did quoted or unquoted (be lost that information already), therefore ambiguous for this particular case.

@inikulin
Copy link
Member

inikulin commented May 4, 2017

Hmm, I guess adding / to the list of characters that trigger unexpected-character-in-unquoted-attribute-value error can resolve this.

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

2 participants