==================
Basic double-quoted string (text/doubleQuotedStringA.dhall)
==================

"ABC"

---

(expression
  (primitive_expression (text_literal (double_quote_literal))))

==================
Basic single-quoted string (text/singleQuotedStringA.dhall)
==================

''
ABC
DEF
''

---

(expression
  (primitive_expression (text_literal (single_quote_literal))))

==================
Unicode double-quoted string (text/unicodeDoubleQuotedStringA.dhall)
==================

"∀(a : Type) → a"

---

(expression
  (primitive_expression (text_literal (double_quote_literal))))

==================
Double-quoted string with escape sequences (text/escapedDoubleQuotedStringA.dhall)
==================

"\\\"\$\\\/\b\f\n\r\t\u{1D11E} \u2200(a : Type) \u2192 a"

---

(expression
  (primitive_expression (text_literal (double_quote_literal
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)))))

==================
Double-quoted string with unicode escape sequences
==================

"A\u2115B\u{1FA00}C\u{43}D\u{00000001F574}E"

---

(expression
  (primitive_expression (text_literal (double_quote_literal
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)
    (double_quote_escaped)))))

==================
Double-quoted string with an invalid unicode escape (text/nonAssignedUnicodeA.dhall)
==================

"\u{1FFF0}"

---

; Intentionally deviating from the spec because I don't see the need to
; validate unicode codepoints for syntax highlighting.
(expression
  (primitive_expression (text_literal
    (double_quote_literal (double_quote_escaped)))))

==================
Single-quoted string with escaped interpolation and single quote (text/escapedSingleQuotedStringA.dhall)
==================

''
''${
'''
''

---

(expression
  (primitive_expression (text_literal (single_quote_literal
    (single_quote_escaped)
    (single_quote_escaped)))))

==================
Single-quoted string with more escape sequences (text/escapeA.dhall)
==================

-- Verify that an implementation is processing escape sequences correctly

''
''${
'''
$
"
\
''

---

(expression
  (line_comment (line_comment_prefix) (line_comment_content))
  (primitive_expression (text_literal (single_quote_literal
    (single_quote_escaped)
    (single_quote_escaped)))))

==================
Double-quoted string with an interpolation (text/interpolatedDoubleQuotedStringA.dhall)
==================

"ABC${Natural/show 123}"

---

(expression
  (primitive_expression (text_literal (double_quote_literal
    (interpolation (expression (application_expression
      (primitive_expression (identifier (builtin)))
      (primitive_expression (numeric_literal (natural_literal))))))))))

==================
Single-quoted string with an interpolation (text/interpolatedSingleQuotedStringA.dhall)
==================

''
ABC
${Natural/show 123}
''

---

(expression
  (primitive_expression (text_literal (single_quote_literal
    (interpolation (expression (application_expression
      (primitive_expression (identifier (builtin)))
      (primitive_expression (numeric_literal (natural_literal))))))))))

==================
Single-quoted string with another interpolation (text/interpolationA.dhall)
==================

{- This example verifies that an implementation is correctly breaking leading
   spaces at interpolated expressions.  The first line has the fewest number of
   leading spaces (2) due to the interruption by the interpolated expression.
-}

''
${Natural/show 1}      foo
  bar
''

---

(expression
  (block_comment
    (block_comment_open) (block_comment_content) (block_comment_close))
  (primitive_expression (text_literal (single_quote_literal
    (interpolation (expression (application_expression
      (primitive_expression (identifier (builtin)))
      (primitive_expression (numeric_literal (natural_literal))))))))))

==================
Double-quoted string with a dollar sign (text/dollarSignA.dhall)
==================

"$"

---

(expression
  (primitive_expression (text_literal (double_quote_literal))))

==================
Single-quoted string with an interior indent (text/interiorIndentA.dhall)
==================

{- The indent is computed as the minimum number of leading spaces over all lines
   in a multi-line literal, including the line right before the closing quotes.
   In this case, there are three lines:

   * The first line containing "  foo" with two leading spaces
   * The second line containing "  bar" with two leading spaces
   * The third line containing "" with zero leading spaces

   Since the last line has zero leading spaces, the minimum number of leading
   spaces over all three lines is zero, so we don't strip any spaces.
-}

''
  foo
  bar
''

---

(expression
  (block_comment
    (block_comment_open) (block_comment_content) (block_comment_close))
  (primitive_expression (text_literal (single_quote_literal))))

==================
Single-quoted string with a full indent (text/multilineBlankLineA.dhall)
==================

    ''
    hello

    there
    ''

---

(expression
  (primitive_expression (text_literal (single_quote_literal))))

==================
Single-quoted string with a full indent and windows line endings (text/multilineBlankLineCrlfA.dhall)
==================

    ''
    hello

    there
    ''

---

(expression
  (primitive_expression (text_literal (single_quote_literal))))

==================
Single-quoted string with leading tabs (leadingTabsA.dhall)
==================

{- This test verifies that leading tabs are correctly stripped

   Since one line is blank and the other line only has tabs, they are all
   stripped since they all count as leading whitespace for dedenting purposes.

   The end result is that the dedented string is equivalent to:

```
''

''
```

   ... which desugars to a single "\n".

   Carefully note that the two spaces before the starting quotes are not
   counted for dedenting purposes.
-}
  ''

		''

---

(expression
  (block_comment
    (block_comment_open) (block_comment_content) (block_comment_close))
  (primitive_expression (text_literal (single_quote_literal))))

==================
Single-quoted string with a tabbed full indent (text/multilineTabsA.dhall)
==================

	''
	hai
		there
	   lol
	''

---

(expression
  (primitive_expression (text_literal (single_quote_literal))))

==================
Single-quoted string with mixed indent (text/multilineIndentedAndAlignedA.dhall)
==================

	 ''
	 hai
	 there
	 ''

---

(expression
  (primitive_expression (text_literal (single_quote_literal))))

==================
Single-quoted string with improper indent (text/multilineCorruptedLeadingWhitespaceA.dhall)
==================

	  	''
	  	hai
	  	there
	   ok
	  	''

---

(expression
  (primitive_expression (text_literal (single_quote_literal))))

==================
Single-quoted string with mixed level indent (text/multilineMismatchedLeadingWhitespaceA.dhall)
==================

''
	a
 b
''

---

(expression
  (primitive_expression (text_literal (single_quote_literal))))

==================
Comments inside a double-quoted string
==================

"-- $--$--{--}$"

---

(expression
  (primitive_expression (text_literal (double_quote_literal))))

==================
Comments inside a single-quoted string (text/preserveCommentA.dhall)
==================

{- A comment within the interior of a multi-line literal counts as part of the
   literal
-}

''
-- Hello
{- world -}
''

---

(expression
  (block_comment
    (block_comment_open) (block_comment_content) (block_comment_close))
  (primitive_expression (text_literal (single_quote_literal))))

==================
Single-quoted string without a newline (text/singleLineA.dhall)
==================

{- This is how you encode a multi-line literal that contains no newlines

   The leading newline is stripped
-}
''
foo''

---

(expression
  (block_comment
    (block_comment_open) (block_comment_content) (block_comment_close))
  (primitive_expression (text_literal (single_quote_literal))))

==================
Single-quoted string with only one newline (text/twoLinesA.dhall)
==================

{- Verify that an implementation is correctly preserving newlines in the
   corresponding double-quoted literal
-}

''
foo
bar''

---

(expression
  (block_comment
    (block_comment_open) (block_comment_content) (block_comment_close))
  (primitive_expression (text_literal (single_quote_literal))))

==================
Single-quoted string can be appended (text/singleQuoteConcatA.dhall)
==================

''
a''
++
''
b''

---

(expression
  (text_append_expression
    (primitive_expression (text_literal (single_quote_literal)))
    (infix_operator)
    (primitive_expression (text_literal (single_quote_literal)))))

==================
Complex single-quoted string (text/interestingA.dhall)
==================

-- Non-trivial example that combines several multi-line literal features

λ(x : Text) → ''
  ${x}    baz
      bar
    foo
    ''

---

(expression
  (line_comment (line_comment_prefix) (line_comment_content))
  (lambda_expression
    (lambda_operator)
    label: (label)
    (type_operator)
    type: (expression (primitive_expression (identifier (builtin))))
    (arrow_operator)
    expression: (expression (primitive_expression
      (text_literal (single_quote_literal (interpolation
        (expression (primitive_expression (identifier (label)))))))))))

==================
Comprehensive string test (text/templateA.dhall)
==================

    \(record : { name        : Text
               , value       : Double
               , taxed_value : Double
               , in_ca       : Bool
               }
     ) ->  ''
Hello ${record.name}
You have just won ${Double/show record.value} dollars!
${ if record.in_ca
   then "Well, ${Double/show record.taxed_value} dollars, after taxes"
   else ""
 }
''

---

(expression
  (lambda_expression
    (lambda_operator)
    label: (label)
    (type_operator)
    type: (expression (primitive_expression (record_type
      (record_type_entry (label) (type_operator)
        type: (expression (primitive_expression (identifier (builtin)))))
      (record_type_entry (label) (type_operator)
        type: (expression (primitive_expression (identifier (builtin)))))
      (record_type_entry (label) (type_operator)
        type: (expression (primitive_expression (identifier (builtin)))))
      (record_type_entry (label) (type_operator)
        type: (expression (primitive_expression (identifier (builtin))))))))
    (arrow_operator)
    expression: (expression
      (primitive_expression (text_literal (single_quote_literal
        (interpolation (expression
          (primitive_expression
            (identifier (label))
            selector: (selector (selector_dot) (label)))))
        (interpolation (expression (application_expression
          (primitive_expression (identifier (builtin)))
          (primitive_expression
            (identifier (label))
            selector: (selector (selector_dot) (label))))))
        (interpolation (expression (if_then_else_expression
          predicate: (expression (primitive_expression
            (identifier (label))
            selector: (selector (selector_dot) (label))))
          expression: (expression (primitive_expression
            (text_literal (double_quote_literal
              (interpolation (expression (application_expression
                (primitive_expression (identifier (builtin)))
                (primitive_expression
                  (identifier (label))
                  selector: (selector (selector_dot) (label))))))))))
          alternate: (expression (primitive_expression
            (text_literal (double_quote_literal)))))))))))))
