Captures a value with its quotes discarded or kept
All 36 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.
The parser trims an unquoted value. It keeps the whitespace of a quoted value. Either quote style protects a pipe, a bracket, and a brace. A blank cell captures null. The Captured Type column is then blank, because the parser captures no value.
The two expectation columns show the same input in the two modes of the parser. A test method reads the value with the quotes discarded. A tool that rewrites a table reads the value with the quotes kept, and the table keeps the quoting the author wrote. Two columns with the same value mean the value has no delimiting quotes.
The parser converts no number. The values 1 and 3.14 capture as text. The parameter type decides a conversion, and the parser does not read the parameter type.
| Scenario | Input | Discarding quotes? | Keeping quotes? | Captured Type? |
|---|---|---|---|---|
| Unquoted | abc | abc | abc | java.lang.String |
| Single quoted | 'abc' | abc | 'abc' | java.lang.String |
| Double quoted | "abc" | abc | "abc" | java.lang.String |
| With spaces | abc def | abc def | abc def | java.lang.String |
| Unquoted is trimmed | a b c | a b c | a b c | java.lang.String |
| Single quoted is not trimmed | ' a b c ' | a b c | ' a b c ' | java.lang.String |
| Double quoted is not trimmed | " a b c " | a b c | " a b c " | java.lang.String |
| Blank is null | ||||
| Empty single quoted | '' | “” | '' | java.lang.String |
| Empty double quoted | "" | “” | "" | java.lang.String |
| Unmatched single quote | ' | ' | ' | java.lang.String |
| Unmatched double quote | " | " | " | java.lang.String |
| Unterminated quote is literal | 'abc | 'abc | 'abc | java.lang.String |
| Quotes inside unquoted value | a'b"c | a'b"c | a'b"c | java.lang.String |
| Single quoted pipe | '|' | | | '|' | java.lang.String |
| Double quoted pipe | "|" | | | "|" | java.lang.String |
| Single quoted opening bracket | '[' | [ | '[' | java.lang.String |
| Double quoted opening bracket | "[" | [ | "[" | java.lang.String |
| Single quoted opening brace | '{' | { | '{' | java.lang.String |
| Double quoted opening brace | "{" | { | "{" | java.lang.String |
| Integer | 1 | 1 | 1 | java.lang.String |
| Decimal | 3.14 | 3.14 | 3.14 | java.lang.String |
| Number with underscores | 1_000_000 | 1_000_000 | 1_000_000 | java.lang.String |
| List with unquoted string | [a] |
|
| java.util.List |
| List with double quoted string | ["a"] |
|
| java.util.List |
| List with single quoted string | ['a'] |
|
| java.util.List |
| Set with unquoted string | {a} |
|
| java.util.Set |
| Set with double quoted string | {"a"} |
|
| java.util.Set |
| Set with single quoted string | {'a'} |
|
| java.util.Set |
| Map with unquoted string | [a: a] |
|
| java.util.Map |
| Map with double quoted string | [a: "a"] |
|
| java.util.Map |
| Map with single quoted string | [a: 'a'] |
|
| java.util.Map |
| Nested with double quoted strings | [double: ["a"]] |
|
| java.util.Map |
| Nested with single quoted strings | [single: ['a']] |
|
| java.util.Map |
| Map with double quoted key | ["k": v] |
|
| java.util.Map |
| Map with single quoted key | ['k': v] |
|
| java.util.Map |