Tells a list from a value that merely starts with a bracket
All 9 scenarios hold
These rules cover one cell value: strings, quoting, the three collection forms, and the errors a malformed value raises. The three collection forms are a list, a set, and a map.
This table holds two outcomes, and the rule is which outcome a value gets. A value that does not open a list captures as a plain string. Quoted brackets, a stray closing bracket, and a letter before the bracket are three such values. A value that opens a list and does not complete it fails to parse.
expected outcome
broken scenario
| Scenario | Input | Parsed type? | Error message? |
|---|---|---|---|
| Quoted brackets | "[]" | java.lang.String | |
| Only closing bracket | ] | java.lang.String | |
| Unexpected leading character | a[] | java.lang.String | |
| Only opening bracket | [ | Failed to parse `[` | |
| Closed by the wrong delimiter | [a, b} | Failed to parse `[a, b}` | |
| Double opening bracket | [[] | Failed to parse `[[]` | |
| Double closing bracket | []] | Failed to parse `]` | |
| Unexpected trailing character | []a | Failed to parse `a` | |
| Missing element | [a,] | Failed to parse `[a,]` |