mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
parse.y: Allow trailing commas for table, set, vector and record construction
Python, Ruby, Javascript, Go, ..., allow use of trailing commas and is even recommended in some style-guides as it keeps diffs smaller. The black formatter for Python even goes as far to take a trailing comma as an indication to format a list one-item on a line. It has been a bit unusual to not be able to put trailing commas in Zeek scripts, so this change allows for it. It explicitly prevents trailing commas in list expressions on the left hand side. Concretely, this disallows trailing commas in the key list expression during table initializations. It probably allows for commas in more places that I haven't fully grasped. Maybe we should tighten those down again if we find them surprising.
This commit is contained in:
parent
017525af71
commit
203a309612
20 changed files with 288 additions and 14 deletions
|
@ -0,0 +1,2 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
error in <...>/trailing-comma-error.zeek, line 2: incorrect syntax for list expression on left-hand side of assignment: trailing comma not allowed (abc, def)
|
Loading…
Add table
Add a link
Reference in a new issue