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

use a trailing comma in arrays #1013

Open
SlowFox71 opened this issue May 6, 2024 · 1 comment
Open

use a trailing comma in arrays #1013

SlowFox71 opened this issue May 6, 2024 · 1 comment

Comments

@SlowFox71
Copy link

While I am at it, things like:

{$a=[
  'foo',
  'bar',
  'baz',
]}

are not possible at the moment (because of the trailing comma). PHP supports this syntax for quite a while, so IMO Smarty should do it as well. IMO (but as I said, I am not really good with parsers), a small change should to the trick:

arrayelements(res)   ::=  arrayelements(a1) COMMA arrayelement(a).  {
    res = a1.','.a;
}
arrayelements(res)   ::=  arrayelement(a1) COMMA arrayelements(a).  {
    res = a1.','.a;
}
@wisskid
Copy link
Contributor

wisskid commented May 6, 2024

Great suggestion, I'll see if we can support this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants