Skip to content

use a trailing comma in arrays #1013

@SlowFox71

Description

@SlowFox71

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;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions