================================================================================
Int literals
================================================================================

package main

const (
  i1 = 42
  i2 = 4_2
  i3 = 0600
  i4 = 0_600
  i5 = 0o600
  i6 = 0O600
  i7 = 0xBadFace
  i8 = 0xBad_Face
  i9 = 0x_67_7a_2f_cc_40_c6
  i10 = 170141183460469231731687303715884105727
  i11 = 170_141183_460469_231731_687303_715884_105727
)

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

(source_file
  (package_clause
    (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (int_literal)))
    (const_spec
      (identifier)
      (expression_list
        (int_literal)))
    (const_spec
      (identifier)
      (expression_list
        (int_literal)))
    (const_spec
      (identifier)
      (expression_list
        (int_literal)))
    (const_spec
      (identifier)
      (expression_list
        (int_literal)))
    (const_spec
      (identifier)
      (expression_list
        (int_literal)))
    (const_spec
      (identifier)
      (expression_list
        (int_literal)))
    (const_spec
      (identifier)
      (expression_list
        (int_literal)))
    (const_spec
      (identifier)
      (expression_list
        (int_literal)))
    (const_spec
      (identifier)
      (expression_list
        (int_literal)))
    (const_spec
      (identifier)
      (expression_list
        (int_literal)))))

================================================================================
Float literals
================================================================================

package main

const (
  f1 = 0.
  f2 = 72.40
  f3 = 072.40
  f4 = 2.71828
  f5 = 1.e+0
  f6 = 6.67428e-11
  f7 = 1E6
  f8 = .25
  f9 = .12345E+5
  f10 = 1_5.
  f11 = 0.15e+0_2
  f12 = 0x1p-2
  f13 = 0x2.p10
  f14 = 0x1.Fp+0
  f15 = 0X.8p-0
  f16 = 0X_1FFFP-16
)

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

(source_file
  (package_clause
    (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))
    (const_spec
      (identifier)
      (expression_list
        (float_literal)))))

================================================================================
Rune literals
================================================================================

package main

const (
  a = '0'
  b = '\''
  c = '\\'
  c = '\n'
  c = '\u0000'
  c = '\U01234567'
)

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

(source_file
  (package_clause
    (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (rune_literal)))
    (const_spec
      (identifier)
      (expression_list
        (rune_literal)))
    (const_spec
      (identifier)
      (expression_list
        (rune_literal)))
    (const_spec
      (identifier)
      (expression_list
        (rune_literal)))
    (const_spec
      (identifier)
      (expression_list
        (rune_literal)))
    (const_spec
      (identifier)
      (expression_list
        (rune_literal)))))

================================================================================
Imaginary literals
================================================================================

package main

const (
  a = 0i
  b = 0123i
  c = 0o123i
  d = 0xabci
  e = 0.i
  f = 2.71828i
  g = 1.e+0i
  h = 6.67428e-11i
  i = 1E6i
  j = .25i
  k = .12345E+5i
  l = 0x1p-2i
)

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

(source_file
  (package_clause
    (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))
    (const_spec
      (identifier)
      (expression_list
        (imaginary_literal)))))

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

package main

const (
  a = "0"
  b = "`\"`"
  c = "\x0c"
  d = "errorstring
  "
)

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

(source_file
  (package_clause
    (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (interpreted_string_literal)))
    (const_spec
      (identifier)
      (expression_list
        (interpreted_string_literal
          (escape_sequence))))
    (const_spec
      (identifier)
      (expression_list
        (interpreted_string_literal
          (escape_sequence))))
    (ERROR
      (identifier))))

================================================================================
Slice literals
================================================================================

package main

const s1 = []string{}

const s2 = []string{"hi"}

const s3 = []string{
  "hi",
  "hello",
}

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

(source_file
  (package_clause
    (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (composite_literal
          (slice_type
            (type_identifier))
          (literal_value)))))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (composite_literal
          (slice_type
            (type_identifier))
          (literal_value
            (literal_element
              (interpreted_string_literal)))))))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (composite_literal
          (slice_type
            (type_identifier))
          (literal_value
            (literal_element
              (interpreted_string_literal))
            (literal_element
              (interpreted_string_literal))))))))

================================================================================
Array literals with implicit length
================================================================================

package main

const a1 = [...]int{1, 2, 3}

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

(source_file
  (package_clause
    (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (composite_literal
          (implicit_length_array_type
            (type_identifier))
          (literal_value
            (literal_element
              (int_literal))
            (literal_element
              (int_literal))
            (literal_element
              (int_literal))))))))

================================================================================
Map literals
================================================================================

package main

const s = map[string]string{
  "hi": "hello",
  "bye": "goodbye",
}

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

(source_file
  (package_clause
    (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (composite_literal
          (map_type
            (type_identifier)
            (type_identifier))
          (literal_value
            (keyed_element
              (literal_element
                (interpreted_string_literal))
              (literal_element
                (interpreted_string_literal)))
            (keyed_element
              (literal_element
                (interpreted_string_literal))
              (literal_element
                (interpreted_string_literal)))))))))

================================================================================
Struct literals
================================================================================

package main

const s1 = Person{
  name: "Frank",
  Age: "5 months",
}

const s2 = struct{i int;}{i: 5}

const s3 = time.Time{}

const g1 = Foo[float64, Bar[int]] { }

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

(source_file
  (package_clause
    (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (composite_literal
          (type_identifier)
          (literal_value
            (keyed_element
              (literal_element
                (identifier))
              (literal_element
                (interpreted_string_literal)))
            (keyed_element
              (literal_element
                (identifier))
              (literal_element
                (interpreted_string_literal))))))))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (composite_literal
          (struct_type
            (field_declaration_list
              (field_declaration
                (field_identifier)
                (type_identifier))))
          (literal_value
            (keyed_element
              (literal_element
                (identifier))
              (literal_element
                (int_literal))))))))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (composite_literal
          (qualified_type
            (package_identifier)
            (type_identifier))
          (literal_value)))))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (composite_literal
          (generic_type
            (type_identifier)
            (type_arguments
              (type_elem
                (type_identifier))
              (type_elem
                (generic_type
                  (type_identifier)
                  (type_arguments
                    (type_elem
                      (type_identifier)))))))
          (literal_value))))))

================================================================================
Function literals
================================================================================

package main

const s1 = func(s string) (int, int) {
  return 1, 2
}

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

(source_file
  (package_clause
    (package_identifier))
  (const_declaration
    (const_spec
      (identifier)
      (expression_list
        (func_literal
          (parameter_list
            (parameter_declaration
              (identifier)
              (type_identifier)))
          (parameter_list
            (parameter_declaration
              (type_identifier))
            (parameter_declaration
              (type_identifier)))
          (block
            (return_statement
              (expression_list
                (int_literal)
                (int_literal)))))))))
