================================================================================
Simple identifiers
================================================================================

helloWorld

--------------------------------------------------------------------------------

(source_file
  (simple_identifier))

================================================================================
Boolean literals
================================================================================

true
false

--------------------------------------------------------------------------------

(source_file
  (boolean_literal)
  (boolean_literal))

================================================================================
String literals
================================================================================

"Hello World!"
"""
This is a "multiline"
string.
"""
"This string has a // comment (except not!)"

--------------------------------------------------------------------------------

(source_file
  (line_string_literal
    (line_str_text))
  (multi_line_string_literal
    (multi_line_str_text)
    (multi_line_str_text)
    (multi_line_str_text))
  (line_string_literal
    (line_str_text)))

================================================================================
String interpolation
================================================================================

"Sample \("string.interpolation") literal"
"""
Multiline
\("""string interpolation""") literal
"""
"This is a string with // a comment in it"
"""
   And so is this! /*
   #if qwertyuiop
   And yet neither of those comments should register
""" // This comment is valid

--------------------------------------------------------------------------------

(source_file
  (line_string_literal
    (line_str_text)
    (interpolated_expression
      (line_string_literal
        (line_str_text)))
    (line_str_text))
  (multi_line_string_literal
    (multi_line_str_text)
    (interpolated_expression
      (multi_line_string_literal
        (multi_line_str_text)))
    (multi_line_str_text))
  (line_string_literal
    (line_str_text))
  (multi_line_string_literal
    (multi_line_str_text))
  (comment))

================================================================================
Custom interpolation
================================================================================
"Hi, I'm \(format: age)"

--------------------------------------------------------------------------------

(source_file
  (line_string_literal
    (line_str_text)
    (interpolated_expression
      (simple_identifier)
      (simple_identifier))))

================================================================================
Strings with newline escaping
================================================================================

"""
This is a string that acts as though it \
    is all on one line
"""

--------------------------------------------------------------------------------

(source_file
  (multi_line_string_literal
    (multi_line_str_text)
    (str_escaped_char)
    (multi_line_str_text)))

================================================================================
Integer literals
================================================================================

0
8
23
9847
0xf00
0o774
0b01

--------------------------------------------------------------------------------

(source_file
  (integer_literal)
  (integer_literal)
  (integer_literal)
  (integer_literal)
  (hex_literal)
  (oct_literal)
  (bin_literal))

================================================================================
Real literals
================================================================================

0.0
-23.434
1e-10
4.3
+53.9e-3

--------------------------------------------------------------------------------

(source_file
  (real_literal)
  (prefix_expression
    (real_literal))
  (real_literal)
  (real_literal)
  (prefix_expression
    (real_literal)))

================================================================================
Collections
================================================================================

let numbers = [1, 2, 3]
let numerals = [1: "I", 4: "IV", 5: "V", 10: "X"]

--------------------------------------------------------------------------------

(source_file
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (simple_identifier)))
    (array_literal
      (integer_literal)
      (integer_literal)
      (integer_literal)))
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (simple_identifier)))
    (dictionary_literal
      (integer_literal)
      (line_string_literal
        (line_str_text))
      (integer_literal)
      (line_string_literal
        (line_str_text))
      (integer_literal)
      (line_string_literal
        (line_str_text))
      (integer_literal)
      (line_string_literal
        (line_str_text)))))

================================================================================
Trailing commas
================================================================================

[
    "Time": Date.now(),
    "Success": true,
]

[1, 2, 3, 4, 5,]

--------------------------------------------------------------------------------

(source_file
  (dictionary_literal
    (line_string_literal
      (line_str_text))
    (call_expression
      (navigation_expression
        (simple_identifier)
        (navigation_suffix
          (simple_identifier)))
      (call_suffix
        (value_arguments)))
    (line_string_literal
      (line_str_text))
    (boolean_literal))
  (array_literal
    (integer_literal)
    (integer_literal)
    (integer_literal)
    (integer_literal)
    (integer_literal)))

================================================================================
Nil
================================================================================

let _ = nil

--------------------------------------------------------------------------------

(source_file
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (wildcard_pattern)))))

================================================================================
Raw strings
================================================================================

let _ = #"Hello, world!"#
let _ = ##"Hello, so-called "world"!"##

--------------------------------------------------------------------------------

(source_file
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (wildcard_pattern)))
    (raw_string_literal
      (raw_str_end_part)))
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (wildcard_pattern)))
    (raw_string_literal
      (raw_str_end_part))))

================================================================================
Doesn't hang for incomplete raw strings (issue #146)
================================================================================

let _ = #"Foo"

---

(source_file
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (wildcard_pattern)))
    (ERROR
      (UNEXPECTED '"'))
    (line_string_literal
      (line_str_text))))

================================================================================
Raw strings with interpolation
================================================================================

extension URL {
    func html(withTitle title: String) -> String {
        return #"<a href="\#(absoluteString)">\#(title)</a>"#
    }
}

--------------------------------------------------------------------------------

(source_file
  (class_declaration
    (user_type
      (type_identifier))
    (class_body
      (function_declaration
        (simple_identifier)
        (parameter
          (simple_identifier)
          (simple_identifier)
          (user_type
            (type_identifier)))
        (user_type
          (type_identifier))
        (function_body
          (statements
            (control_transfer_statement
              (raw_string_literal
                (raw_str_part)
                (raw_str_interpolation
                  (raw_str_interpolation_start)
                  (interpolated_expression
                    (simple_identifier)))
                (raw_str_part)
                (raw_str_interpolation
                  (raw_str_interpolation_start)
                  (interpolated_expression
                    (simple_identifier)))
                (raw_str_end_part)))))))))

================================================================================
Raw strings interpolation edge cases
================================================================================

print(#"Hello \#(world /* commented out)"#)  */ )"#)

let _ = ##"Multiple pound signs \##(interpolated): still one part "# not done yet "##
let _ = ##"Fake \#(interpolation) and unused # pound signs "##
let _ = ##"\##(a)\#(b)\##(c)\#(d)"# ##"##

--------------------------------------------------------------------------------

(source_file
  (call_expression
    (simple_identifier)
    (call_suffix
      (value_arguments
        (value_argument
          (raw_string_literal
            (raw_str_part)
            (raw_str_interpolation
              (raw_str_interpolation_start)
              (interpolated_expression
                (simple_identifier))
              (multiline_comment))
            (raw_str_end_part))))))
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (wildcard_pattern)))
    (raw_string_literal
      (raw_str_part)
      (raw_str_interpolation
        (raw_str_interpolation_start)
        (interpolated_expression
          (simple_identifier)))
      (raw_str_end_part)))
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (wildcard_pattern)))
    (raw_string_literal
      (raw_str_end_part)))
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (wildcard_pattern)))
    (raw_string_literal
      (raw_str_part)
      (raw_str_interpolation
        (raw_str_interpolation_start)
        (interpolated_expression
          (simple_identifier)))
      (raw_str_part)
      (raw_str_interpolation
        (raw_str_interpolation_start)
        (interpolated_expression
          (simple_identifier)))
      (raw_str_end_part))))

================================================================================
Unicode escape sequences
================================================================================

let unicodeEscaping = "\u{8}"
let anotherUnicode = "…\u{2060}"
let infinity = "\u{221E}"

--------------------------------------------------------------------------------

(source_file
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (simple_identifier)))
    (line_string_literal
      (str_escaped_char)))
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (simple_identifier)))
    (line_string_literal
      (line_str_text)
      (str_escaped_char)))
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (simple_identifier)))
    (line_string_literal
      (str_escaped_char))))

================================================================================
Playground literals
================================================================================

let playgroundLiteral = #imageLiteral(resourceName: "heart")

--------------------------------------------------------------------------------

(source_file
  (property_declaration
    (value_binding_pattern
      (non_binding_pattern
        (simple_identifier)))
    (simple_identifier)
    (line_string_literal
      (line_str_text))))
