---
source: crates/squawk_parser/tests/tests.rs
input_file: crates/squawk_parser/tests/data/ok/select_compound_union_select.sql
---
SOURCE_FILE
  SELECT
    SELECT_CLAUSE
      SELECT_KW "SELECT"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          PAREN_EXPR
            L_PAREN "("
            WHITESPACE "\n    "
            COMPOUND_SELECT
              PAREN_EXPR
                L_PAREN "("
                SELECT
                  SELECT_CLAUSE
                    SELECT_KW "SELECT"
                    WHITESPACE " "
                    TARGET_LIST
                      TARGET
                        NAME_REF
                          IDENT "id"
                  WHITESPACE " "
                  FROM_CLAUSE
                    FROM_KW "FROM"
                    WHITESPACE " "
                    FROM_ITEM
                      NAME_REF
                        IDENT "code_categories"
                  WHITESPACE " "
                  WHERE_CLAUSE
                    WHERE_KW "WHERE"
                    WHITESPACE " "
                    BIN_EXPR
                      NAME_REF
                        IDENT "\"language\""
                      WHITESPACE " "
                      EQ "="
                      WHITESPACE " "
                      PREFIX_EXPR
                        CUSTOM_OP
                          AT "@"
                        CAST_EXPR
                          NAME_REF
                            LANGUAGE_KW "language"
                          COLON_COLON
                            COLON ":"
                            COLON ":"
                          CHAR_TYPE
                            CHAR_KW "char"
                            ARG_LIST
                              L_PAREN "("
                              ARG
                                LITERAL
                                  INT_NUMBER "4"
                              R_PAREN ")"
                  WHITESPACE " "
                  ORDER_BY_CLAUSE
                    ORDER_KW "ORDER"
                    WHITESPACE " "
                    BY_KW "BY"
                    WHITESPACE " "
                    SORT_BY_LIST
                      SORT_BY
                        NAME_REF
                          IDENT "\"id\""
                        WHITESPACE " "
                        SORT_ASC
                          ASC_KW "ASC"
                  WHITESPACE " "
                  LIMIT_CLAUSE
                    LIMIT_KW "LIMIT"
                    WHITESPACE " "
                    LITERAL
                      INT_NUMBER "1"
                R_PAREN ")"
              WHITESPACE "\n    "
              UNION_KW "UNION"
              WHITESPACE "\n    "
              PAREN_SELECT
                L_PAREN "("
                SELECT
                  SELECT_CLAUSE
                    SELECT_KW "SELECT"
                    WHITESPACE " "
                    TARGET_LIST
                      TARGET
                        NAME_REF
                          IDENT "id"
                  WHITESPACE " "
                  FROM_CLAUSE
                    FROM_KW "FROM"
                    WHITESPACE " "
                    FROM_ITEM
                      NAME_REF
                        IDENT "code_categories"
                  WHITESPACE " "
                  WHERE_CLAUSE
                    WHERE_KW "WHERE"
                    WHITESPACE " "
                    BIN_EXPR
                      NAME_REF
                        IDENT "\"language\""
                      WHITESPACE " "
                      EQ "="
                      WHITESPACE " "
                      LITERAL
                        STRING "'nl-NL'"
                  WHITESPACE " "
                  ORDER_BY_CLAUSE
                    ORDER_KW "ORDER"
                    WHITESPACE " "
                    BY_KW "BY"
                    WHITESPACE " "
                    SORT_BY_LIST
                      SORT_BY
                        NAME_REF
                          IDENT "\"id\""
                        WHITESPACE " "
                        SORT_ASC
                          ASC_KW "ASC"
                  WHITESPACE " "
                  LIMIT_CLAUSE
                    LIMIT_KW "LIMIT"
                    WHITESPACE " "
                    LITERAL
                      INT_NUMBER "1"
                R_PAREN ")"
            WHITESPACE "\n"
            R_PAREN ")"
    WHITESPACE " "
    LIMIT_CLAUSE
      LIMIT_KW "LIMIT"
      WHITESPACE " "
      LITERAL
        INT_NUMBER "1"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- version without parentheses."
  WHITESPACE "\n"
  SELECT
    SELECT_CLAUSE
      SELECT_KW "SELECT"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          PAREN_EXPR
            L_PAREN "("
            WHITESPACE "\n    "
            COMPOUND_SELECT
              PAREN_EXPR
                L_PAREN "("
                SELECT
                  SELECT_CLAUSE
                    SELECT_KW "SELECT"
                    WHITESPACE " "
                    TARGET_LIST
                      TARGET
                        NAME_REF
                          IDENT "id"
                  WHITESPACE " "
                  FROM_CLAUSE
                    FROM_KW "FROM"
                    WHITESPACE " "
                    FROM_ITEM
                      NAME_REF
                        IDENT "code_categories"
                  WHITESPACE " "
                  WHERE_CLAUSE
                    WHERE_KW "WHERE"
                    WHITESPACE " "
                    BIN_EXPR
                      NAME_REF
                        IDENT "\"language\""
                      WHITESPACE " "
                      EQ "="
                      WHITESPACE " "
                      PREFIX_EXPR
                        CUSTOM_OP
                          AT "@"
                        CAST_EXPR
                          NAME_REF
                            LANGUAGE_KW "language"
                          COLON_COLON
                            COLON ":"
                            COLON ":"
                          CHAR_TYPE
                            CHAR_KW "char"
                            ARG_LIST
                              L_PAREN "("
                              ARG
                                LITERAL
                                  INT_NUMBER "4"
                              R_PAREN ")"
                  WHITESPACE " "
                  ORDER_BY_CLAUSE
                    ORDER_KW "ORDER"
                    WHITESPACE " "
                    BY_KW "BY"
                    WHITESPACE " "
                    SORT_BY_LIST
                      SORT_BY
                        NAME_REF
                          IDENT "\"id\""
                        WHITESPACE " "
                        SORT_ASC
                          ASC_KW "ASC"
                  WHITESPACE " "
                  LIMIT_CLAUSE
                    LIMIT_KW "LIMIT"
                    WHITESPACE " "
                    LITERAL
                      INT_NUMBER "1"
                R_PAREN ")"
              WHITESPACE "\n    "
              UNION_KW "UNION"
              WHITESPACE "\n    "
              SELECT
                SELECT_CLAUSE
                  SELECT_KW "SELECT"
                  WHITESPACE " "
                  TARGET_LIST
                    TARGET
                      NAME_REF
                        IDENT "id"
                WHITESPACE " "
                FROM_CLAUSE
                  FROM_KW "FROM"
                  WHITESPACE " "
                  FROM_ITEM
                    NAME_REF
                      IDENT "code_categories"
                WHITESPACE " "
                WHERE_CLAUSE
                  WHERE_KW "WHERE"
                  WHITESPACE " "
                  BIN_EXPR
                    NAME_REF
                      IDENT "\"language\""
                    WHITESPACE " "
                    EQ "="
                    WHITESPACE " "
                    LITERAL
                      STRING "'nl-NL'"
              WHITESPACE " "
              ORDER_BY_CLAUSE
                ORDER_KW "ORDER"
                WHITESPACE " "
                BY_KW "BY"
                WHITESPACE " "
                SORT_BY_LIST
                  SORT_BY
                    NAME_REF
                      IDENT "\"id\""
                    WHITESPACE " "
                    SORT_ASC
                      ASC_KW "ASC"
              WHITESPACE " "
              LIMIT_CLAUSE
                LIMIT_KW "LIMIT"
                WHITESPACE " "
                LITERAL
                  INT_NUMBER "1"
            WHITESPACE "\n"
            R_PAREN ")"
    WHITESPACE " "
    LIMIT_CLAUSE
      LIMIT_KW "LIMIT"
      WHITESPACE " "
      LITERAL
        INT_NUMBER "1"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMPOUND_SELECT
    SELECT
      SELECT_CLAUSE
        SELECT_KW "select"
        WHITESPACE " "
        TARGET_LIST
          TARGET
            STAR "*"
      WHITESPACE " "
      FROM_CLAUSE
        FROM_KW "from"
        WHITESPACE " "
        FROM_ITEM
          NAME_REF
            IDENT "t"
    WHITESPACE " "
    UNION_KW "union"
    WHITESPACE " "
    TABLE
      TABLE_KW "table"
      WHITESPACE " "
      RELATION_NAME
        PATH
          PATH_SEGMENT
            NAME_REF
              IDENT "t"
  SEMICOLON ";"
  WHITESPACE "\n"
  COMPOUND_SELECT
    TABLE
      TABLE_KW "table"
      WHITESPACE " "
      RELATION_NAME
        PATH
          PATH_SEGMENT
            NAME_REF
              IDENT "t"
    WHITESPACE " "
    UNION_KW "union"
    WHITESPACE " "
    TABLE
      TABLE_KW "table"
      WHITESPACE " "
      RELATION_NAME
        PATH
          PATH_SEGMENT
            NAME_REF
              IDENT "t"
  SEMICOLON ";"
  WHITESPACE "\n"
  COMPOUND_SELECT
    PAREN_SELECT
      L_PAREN "("
      SELECT
        SELECT_CLAUSE
          SELECT_KW "select"
          WHITESPACE " "
          TARGET_LIST
            TARGET
              LITERAL
                INT_NUMBER "1"
      R_PAREN ")"
    WHITESPACE " "
    UNION_KW "union"
    WHITESPACE " "
    PAREN_SELECT
      L_PAREN "("
      TABLE
        TABLE_KW "table"
        WHITESPACE " "
        RELATION_NAME
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "t"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMPOUND_SELECT
    SELECT_INTO
      SELECT_CLAUSE
        SELECT_KW "select"
        WHITESPACE " "
        TARGET_LIST
          TARGET
            NAME_REF
              IDENT "a"
          COMMA ","
          WHITESPACE " "
          TARGET
            NAME_REF
              IDENT "b"
          COMMA ","
          WHITESPACE " "
          TARGET
            NAME_REF
              IDENT "c"
      WHITESPACE " "
      INTO_CLAUSE
        INTO_KW "into"
        WHITESPACE " "
        PATH
          PATH_SEGMENT
            NAME
              IDENT "t"
      WHITESPACE " "
      FROM_CLAUSE
        FROM_KW "from"
        WHITESPACE " "
        FROM_ITEM
          NAME_REF
            IDENT "t2"
    WHITESPACE " "
    UNION_KW "union"
    WHITESPACE " "
    PAREN_SELECT
      L_PAREN "("
      SELECT
        SELECT_CLAUSE
          SELECT_KW "select"
          WHITESPACE " "
          TARGET_LIST
            TARGET
              LITERAL
                INT_NUMBER "2"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMPOUND_SELECT
    VALUES
      VALUES_KW "values"
      WHITESPACE " "
      ROW_LIST
        ROW
          L_PAREN "("
          LITERAL
            INT_NUMBER "1"
          R_PAREN ")"
        COMMA ","
        WHITESPACE " "
        ROW
          L_PAREN "("
          LITERAL
            INT_NUMBER "2"
          R_PAREN ")"
    WHITESPACE " "
    UNION_KW "union"
    WHITESPACE " "
    VALUES
      VALUES_KW "values"
      WHITESPACE " "
      ROW_LIST
        ROW
          L_PAREN "("
          LITERAL
            INT_NUMBER "3"
          R_PAREN ")"
        COMMA ","
        WHITESPACE " "
        ROW
          L_PAREN "("
          LITERAL
            INT_NUMBER "4"
          R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  PAREN_SELECT
    L_PAREN "("
    PAREN_SELECT
      L_PAREN "("
      COMPOUND_SELECT
        PAREN_SELECT
          L_PAREN "("
          PAREN_SELECT
            L_PAREN "("
            PAREN_SELECT
              L_PAREN "("
              SELECT
                SELECT_CLAUSE
                  SELECT_KW "select"
                  WHITESPACE " "
                  TARGET_LIST
                    TARGET
                      LITERAL
                        INT_NUMBER "1"
              R_PAREN ")"
            R_PAREN ")"
          R_PAREN ")"
        WHITESPACE " "
        UNION_KW "union"
        WHITESPACE " "
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "1"
      R_PAREN ")"
    R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  SELECT
    SELECT_CLAUSE
      SELECT_KW "select"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          STAR "*"
    WHITESPACE " "
    FROM_CLAUSE
      FROM_KW "from"
      WHITESPACE " "
      FROM_ITEM
        PAREN_EXPR
          L_PAREN "("
          FROM_ITEM
            PAREN_SELECT
              COMPOUND_SELECT
                PAREN_SELECT
                  L_PAREN "("
                  FROM_ITEM
                    PAREN_EXPR
                      L_PAREN "("
                      FROM_ITEM
                        PAREN_EXPR
                          L_PAREN "("
                          FROM_ITEM
                            PAREN_SELECT
                              L_PAREN "("
                              SELECT
                                SELECT_CLAUSE
                                  SELECT_KW "select"
                                  WHITESPACE " "
                                  TARGET_LIST
                                    TARGET
                                      LITERAL
                                        INT_NUMBER "1"
                              R_PAREN ")"
                          R_PAREN ")"
                      R_PAREN ")"
                WHITESPACE " "
                UNION_KW "union"
                WHITESPACE " "
                SELECT
                  SELECT_CLAUSE
                    SELECT_KW "select"
                    WHITESPACE " "
                    TARGET_LIST
                      TARGET
                        LITERAL
                          INT_NUMBER "1"
              R_PAREN ")"
          R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  SELECT
    SELECT_CLAUSE
      SELECT_KW "select"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          STAR "*"
    WHITESPACE " "
    FROM_CLAUSE
      FROM_KW "from"
      WHITESPACE " "
      FROM_ITEM
        PAREN_SELECT
          L_PAREN "("
          FROM_ITEM
            PAREN_EXPR
              L_PAREN "("
              FROM_ITEM
                COMPOUND_SELECT
                  PAREN_SELECT
                    L_PAREN "("
                    SELECT
                      SELECT_CLAUSE
                        SELECT_KW "select"
                        WHITESPACE " "
                        TARGET_LIST
                          TARGET
                            LITERAL
                              INT_NUMBER "1"
                    R_PAREN ")"
                  WHITESPACE " "
                  UNION_KW "union"
                  WHITESPACE " "
                  SELECT
                    SELECT_CLAUSE
                      SELECT_KW "select"
                      WHITESPACE " "
                      TARGET_LIST
                        TARGET
                          LITERAL
                            INT_NUMBER "2"
              R_PAREN ")"
          WHITESPACE " "
          LIMIT_CLAUSE
            LIMIT_KW "limit"
            WHITESPACE " "
            LITERAL
              INT_NUMBER "1"
          R_PAREN ")"
        WHITESPACE " "
        ALIAS
          AS_KW "as"
          WHITESPACE " "
          NAME
            IDENT "t"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  PAREN_SELECT
    L_PAREN "("
    COMPOUND_SELECT
      SELECT_INTO
        SELECT_CLAUSE
          SELECT_KW "select"
          WHITESPACE " "
          TARGET_LIST
            TARGET
              LITERAL
                INT_NUMBER "1"
              WHITESPACE " "
              AS_NAME
                NAME
                  IDENT "a"
        WHITESPACE " "
        INTO_CLAUSE
          INTO_KW "into"
          WHITESPACE " "
          PATH
            PATH_SEGMENT
              NAME
                IDENT "t"
      WHITESPACE " "
      UNION_KW "union"
      WHITESPACE " "
      SELECT
        SELECT_CLAUSE
          SELECT_KW "select"
          WHITESPACE " "
          TARGET_LIST
            TARGET
              LITERAL
                INT_NUMBER "1"
              WHITESPACE " "
              AS_NAME
                NAME
                  IDENT "b"
    R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
