How are redundant commas due to auto-insertion are avoided? #2425
-
|
The following input (foo.cue) seems to be valid as a CUE. According to https://cuelang.org/docs/references/spec/#commas, Since the final token on a line is 5(number), a comma is automatically inserted. foo: 5
,,bar: "bar" |
Beta Was this translation helpful? Give feedback.
Answered by
slewiskelly
May 30, 2023
Replies: 1 comment 4 replies
-
|
No. If the comma is already present, another would not be inserted. Have you observed this behavior? The example given output doesn't show this (it does show another oddity, though). |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's not stated explicitly, but it would make sense that this is the case. Nevertheless, the language spec says that:
and
Therefore the parser is to handle both the inclusion and ommission of commas.
Furthermore, CUE is a superset of JSON; which requires commas at the end of lines, but, annoyingly, not the last element. CUE relaxes both of these rules. 1
Footnotes
https://cuelang.org/docs/tutorials/tour/intro/json/ ↩