Object declaration syntax
Posted: 21 Jan 2018, 21:48
Currently, both in AHK 1.1 and 2.0-a, one can declare objects like this:
The downside of this syntax for multi-line objects is that it is relatively hard to edit. For instance, one cannot just move or delete whole lines to reorder or delete items since the first and the last items differ from the other ones in formatting. Simple tasks need too much editing.
Is it possible to make the syntax a bit less strict?
Namely:
This would allow all the item lines being formatted identically making editing considerably simpler.
Code: Select all
singleLineArray := [ "item1", "item2", "item3" ]
singleLineObject := { key1: "value1", key2: "value2", key3: "value3" }
multiLineArray
:= [ "item1"
, "item2"
, "item3" ]
multiLineObject
:= { key1: "value1"
, key2: "value2"
, key3: "value3" }
Is it possible to make the syntax a bit less strict?
Namely:
- Allow line breaks around the brackets
- Allow trailing comma after the last item
Code: Select all
multiLineArray :=
[
"item1",
"item2",
"item3",
]
multiLineObject :=
{
key1: "value1",
key2: "value2",
key3: "value3",
}