diff --git a/cue/literal/quote.go b/cue/literal/quote.go index 3d5ac2a0b..9cbe6e82f 100644 --- a/cue/literal/quote.go +++ b/cue/literal/quote.go @@ -40,7 +40,7 @@ type Form struct { // - QuoteExact that fails with an error if a string cannot be represented // without loss. // - Handle auto-breaking for long lines (Swift-style, \-terminated lines). -// This is not supported yet in CUE, but may, and should be considred as +// This is not supported yet in CUE, but may, and should be considered as // a possibility in API design. // - Other possible convenience forms: Blob (auto-break bytes), String (bytes // or string), Label. diff --git a/cue/literal/string.go b/cue/literal/string.go index 8fa52d96f..59fae0a60 100644 --- a/cue/literal/string.go +++ b/cue/literal/string.go @@ -59,6 +59,16 @@ func (q QuoteInfo) IsDouble() bool { return q.char == '"' } +// IsMulti reports whether a multi-line string was parsed. +func (q QuoteInfo) IsMulti() bool { + return q.multiline +} + +// Whitespace returns prefix whitespace for multiline strings. +func (q QuoteInfo) Whitespace() string { + return q.whitespace +} + // ParseQuotes checks if the opening quotes in start matches the ending quotes // in end and reports its type as q or an error if they do not matching or are // invalid. nStart indicates the number of bytes used for the opening quote.