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

Parser does not accept if or each block argument in parentheses #534

Closed
Conduitry opened this issue Apr 28, 2017 · 2 comments
Closed

Parser does not accept if or each block argument in parentheses #534

Conduitry opened this issue Apr 28, 2017 · 2 comments

Comments

@Conduitry
Copy link
Member

Attempting to parse {{#if (condition)}}...{{/if}} results in an Expected }} parsing error at the ). And attempting to parse {{#each (list) as item}}...{{/each}} results in an Expected as parsing error at the ).

@Conduitry
Copy link
Member Author

Looks like this affects regular mustaches as well. {{(a)}} fails to parse.

Not sure whether this is a bug in Acorn, or just something about their API I'm not understanding. acorn.parseExpressionAt('{{(a)}}', 2) returns { type: 'Identifier', start: 3, end: 4, name: 'a' }. I suppose this makes sense from Acorn's point of view, but it's a bit unfortunate in this case.

@Conduitry
Copy link
Member Author

This can be addressed with the { preserveParens: true } option in Acorn. This doesn't appear to have any ill effects. I'll submit a PR shortly.

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