smarty-php / smarty-php/smarty
use a trailing comma in arrays
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- PHP
- Stars
- 2.3k
- Forks
- 709
- PR merge metrics
- No merged PRs in 30d
Description
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;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue identifies the arrayelements grammar productions as the entry point; start by locating the parser grammar that handles array elements and compare it with the trailing-comma PHP example. Done means the example parses successfully while existing array syntax remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100