================================================================================
One line comment without linebreak
================================================================================
--
--------------------------------------------------------------------------------

(file
  (line_comment))

================================================================================
One line comments
================================================================================

-- MODEL
-- update
-- more words
-- note: (isOkay x || any isOkay xs) would not get TCO

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

(file
  (line_comment)
  (line_comment)
  (line_comment)
  (line_comment))

================================================================================
Block comments
================================================================================

{- one line -}
{- a multiline comment
  how nice
-}
{-| Returns a dictionary mapping `ScreenId` to its problems, if any.
-}
{--}
-- add x y = x + y
--}

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

(file
  (block_comment)
  (block_comment)
  (block_comment)
  (block_comment)
  (line_comment)
  (line_comment))

================================================================================
Complex Block comment
================================================================================

{-| Works just like [`Parser.Nestable`](Parser#nestable) to help distinguish
between unnestable `/*` `*/` comments like in JS and nestable `{-` `-}`
comments like in Gren.
-}

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

(file
  (block_comment))

================================================================================
Comment syntax within a string
================================================================================

module Main exposing ( ..)
one="\"{-"
two="""-}
notAThing = something
\"""
notAThing2 = something
"""
three = '"' {- "
notAThing3 = something
-}
four{--}=--{-
    1
five = something
--}

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

(file
  (module_declaration
    (module)
    (upper_case_qid
      (upper_case_identifier))
    (exposing_list
      (exposing)
      (double_dot)))
  (value_declaration
    (function_declaration_left
      (lower_case_identifier))
    (eq)
    (string_constant_expr
      (open_quote)
      (string_escape)
      (regular_string_part)
      (close_quote)))
  (value_declaration
    (function_declaration_left
      (lower_case_identifier))
    (eq)
    (string_constant_expr
      (open_quote)
      (regular_string_part)
      (string_escape)
      (regular_string_part)
      (close_quote)))
  (value_declaration
    (function_declaration_left
      (lower_case_identifier))
    (eq)
    (char_constant_expr
      (open_char)
      (regular_string_part)
      (close_char)))
  (block_comment)
  (value_declaration
    (function_declaration_left
      (lower_case_identifier))
    (block_comment)
    (eq)
    (line_comment)
    (number_constant_expr
      (number_literal)))
  (value_declaration
    (function_declaration_left
      (lower_case_identifier))
    (eq)
    (value_expr
      (value_qid
        (lower_case_identifier))))
  (line_comment))

================================================================================
Nested block comment are not nested for now
================================================================================

{- comment {- nested comment -} -}

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

(file
  (block_comment))

================================================================================
Empty comment
================================================================================

module A exposing (match)

{-
-}

match : String -> Maybe { a: String, b: String }
match input =
    Nothing

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

    (file
      (module_declaration
        (module)
        (upper_case_qid
          (upper_case_identifier))
        (exposing_list
          (exposing)
          (exposed_value
            (lower_case_identifier))))
      (block_comment)
      (type_annotation
        (lower_case_identifier)
        (colon)
        (type_expression
          (type_ref
            (upper_case_qid
              (upper_case_identifier)))
          (arrow)
          (type_ref
            (upper_case_qid
              (upper_case_identifier))
            (record_type
              (field_type
                (lower_case_identifier)
                (colon)
                (type_expression
                  (type_ref
                    (upper_case_qid
                      (upper_case_identifier)))))
              (field_type
                (lower_case_identifier)
                (colon)
                (type_expression
                  (type_ref
                    (upper_case_qid
                      (upper_case_identifier)))))))))
      (value_declaration
        (function_declaration_left
          (lower_case_identifier)
          (lower_pattern
            (lower_case_identifier)))
        (eq)
        (value_expr
          (upper_case_qid
            (upper_case_identifier)))))

================================================================================
Empty comment inside function
================================================================================

match : String -> Maybe { a: String, b: String }
match input =
    {-
-}
    Nothing

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

(file
      (type_annotation
        (lower_case_identifier)
        (colon)
        (type_expression
          (type_ref
            (upper_case_qid
              (upper_case_identifier)))
          (arrow)
          (type_ref
            (upper_case_qid
              (upper_case_identifier))
            (record_type
              (field_type
                (lower_case_identifier)
                (colon)
                (type_expression
                  (type_ref
                    (upper_case_qid
                      (upper_case_identifier)))))
              (field_type
                (lower_case_identifier)
                (colon)
                (type_expression
                  (type_ref
                    (upper_case_qid
                      (upper_case_identifier)))))))))
      (value_declaration
        (function_declaration_left
          (lower_case_identifier)
          (lower_pattern
            (lower_case_identifier)))
        (eq)
        (block_comment)
        (value_expr
          (upper_case_qid
            (upper_case_identifier)))))

================================================================================
Type declaration with single variant with line comment
================================================================================

type Foo
    = Bar -- This is a Bar

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

(file
  (type_declaration
    (type)
    (upper_case_identifier)
    (eq)
    (union_variant
      (upper_case_identifier)
      (line_comment)))
)

================================================================================
Type declaration with line comment per union variant
================================================================================

type Foo
    = Bar -- This is a Bar
    | Biz -- This is a Biz

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

(file
  (type_declaration
    (type)
    (upper_case_identifier)
    (eq)
    (union_variant
      (upper_case_identifier)
      (line_comment))
    (union_variant
      (upper_case_identifier)
      (line_comment)))
)

================================================================================
Type declaration with union variant and associated data and line comment on new line
================================================================================

type Foo
    = Bar
        -- First associated data
        Int

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

(file
      (type_declaration
        (type)
        (upper_case_identifier)
        (eq)
        (union_variant
          (upper_case_identifier)
          (line_comment)
          (type_ref
            (upper_case_qid
              (upper_case_identifier))))))

================================================================================
Type declaration with union variant and associated data with line comment on same line
================================================================================

type Foo
    = Bar
        Int -- First associated data
        Float -- Second associated data

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

(file
      (type_declaration
        (type)
        (upper_case_identifier)
        (eq)
        (union_variant
          (upper_case_identifier)
          (type_ref
            (upper_case_qid
              (upper_case_identifier)))
          (line_comment)
          (type_ref
            (upper_case_qid
              (upper_case_identifier)))
          (line_comment))))
