---
source: crates/squawk_parser/tests/tests.rs
input_file: crates/squawk_parser/tests/data/err/select_cte.sql
---
SOURCE_FILE
  SELECT
    WITH_CLAUSE
      WITH_KW "with"
      WHITESPACE " "
      WITH_TABLE
        NAME
          IDENT "t"
        WHITESPACE " "
        AS_KW "as"
        WHITESPACE " "
        L_PAREN "("
        WHITESPACE "\n  "
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "1"
        WHITESPACE "\n"
        R_PAREN ")"
      ERROR
        COMMA ","
    WHITESPACE " "
    COMMENT "-- <--- extra comma!"
    WHITESPACE "\n"
    SELECT_CLAUSE
      SELECT_KW "select"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          STAR "*"
    WHITESPACE " "
    FROM_CLAUSE
      FROM_KW "from"
      WHITESPACE " "
      FROM_ITEM
        NAME_REF
          IDENT "t"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- search depth missing item"
  WHITESPACE "\n"
  SELECT
    WITH_CLAUSE
      WITH_KW "with"
      WHITESPACE " "
      WITH_TABLE
        NAME
          IDENT "t"
        WHITESPACE " "
        AS_KW "as"
        WHITESPACE " "
        L_PAREN "("
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "1"
        R_PAREN ")"
        WHITESPACE "\n"
        SEARCH_KW "search"
        WHITESPACE " "
        DEPTH_KW "depth"
        WHITESPACE " "
        FIRST_KW "first"
        WHITESPACE " "
        BY_KW "by"
        WHITESPACE " "
        NAME_REF
          IDENT "a"
        COMMA ","
        WHITESPACE " "
        ERROR
          COMMA ","
        WHITESPACE " "
        NAME_REF
          IDENT "c"
        WHITESPACE " "
        SET_KW "set"
        WHITESPACE " "
        NAME_REF
          IDENT "ordercol"
    WHITESPACE "\n"
    SELECT_CLAUSE
      SELECT_KW "select"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          STAR "*"
    WHITESPACE " "
    FROM_CLAUSE
      FROM_KW "from"
      WHITESPACE " "
      FROM_ITEM
        NAME_REF
          IDENT "t"
    WHITESPACE " "
    ORDER_BY_CLAUSE
      ORDER_KW "order"
      WHITESPACE " "
      BY_KW "by"
      WHITESPACE " "
      SORT_BY_LIST
        SORT_BY
          NAME_REF
            IDENT "ordercol"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- search depth missing comma"
  WHITESPACE "\n"
  SELECT
    WITH_CLAUSE
      WITH_KW "with"
      WHITESPACE " "
      WITH_TABLE
        NAME
          IDENT "t"
        WHITESPACE " "
        AS_KW "as"
        WHITESPACE " "
        L_PAREN "("
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "1"
        R_PAREN ")"
        WHITESPACE "\n"
        SEARCH_KW "search"
        WHITESPACE " "
        DEPTH_KW "depth"
        WHITESPACE " "
        FIRST_KW "first"
        WHITESPACE " "
        BY_KW "by"
        WHITESPACE " "
        NAME_REF
          IDENT "a"
        COMMA ","
        WHITESPACE " "
        NAME_REF
          IDENT "b"
        WHITESPACE " "
        NAME_REF
          IDENT "c"
        WHITESPACE " "
        SET_KW "set"
        WHITESPACE " "
        NAME_REF
          IDENT "ordercol"
    WHITESPACE "\n"
    SELECT_CLAUSE
      SELECT_KW "select"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          STAR "*"
    WHITESPACE " "
    FROM_CLAUSE
      FROM_KW "from"
      WHITESPACE " "
      FROM_ITEM
        NAME_REF
          IDENT "t"
    WHITESPACE " "
    ORDER_BY_CLAUSE
      ORDER_KW "order"
      WHITESPACE " "
      BY_KW "by"
      WHITESPACE " "
      SORT_BY_LIST
        SORT_BY
          NAME_REF
            IDENT "ordercol"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- extra with"
  WHITESPACE "\n"
  SELECT
    WITH_CLAUSE
      WITH_KW "with"
      WHITESPACE " "
      WITH_TABLE
        NAME
          IDENT "t"
        WHITESPACE " "
        AS_KW "as"
        WHITESPACE " "
        L_PAREN "("
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "1"
        R_PAREN ")"
      COMMA ","
      WHITESPACE "\n"
      ERROR
        WITH_KW "with"
      WHITESPACE " "
      WITH_TABLE
        NAME
          IDENT "f"
        WHITESPACE " "
        AS_KW "as"
        WHITESPACE " "
        L_PAREN "("
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "2"
        R_PAREN ")"
    WHITESPACE "\n"
    SELECT_CLAUSE
      SELECT_KW "select"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          STAR "*"
    WHITESPACE " "
    FROM_CLAUSE
      FROM_KW "from"
      WHITESPACE " "
      FROM_ITEM
        NAME_REF
          IDENT "t"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  SELECT
    WITH_CLAUSE
      WITH_KW "with"
      WHITESPACE " \n   "
      WITH_TABLE
        NAME
          IDENT "a"
        WHITESPACE " "
        AS_KW "as"
        WHITESPACE " "
        L_PAREN "("
        WHITESPACE "\n      "
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "1"
        WHITESPACE "\n   "
        R_PAREN ")"
      WHITESPACE " "
      COMMENT "-- <-- missing a comma"
      WHITESPACE "\n   "
      WITH_TABLE
        NAME
          IDENT "b"
        WHITESPACE " "
        AS_KW "as"
        WHITESPACE " "
        L_PAREN "("
        WHITESPACE "\n      "
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "3"
        WHITESPACE "\n   "
        R_PAREN ")"
    WHITESPACE "\n"
    SELECT_CLAUSE
      SELECT_KW "select"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          LITERAL
            INT_NUMBER "2"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- table name isn't an plain ident"
  WHITESPACE "\n"
  SELECT
    WITH_CLAUSE
      WITH_KW "with"
      WHITESPACE " \n   "
      WITH_TABLE
        NAME
          IDENT "a"
        WHITESPACE " "
        AS_KW "as"
        WHITESPACE " "
        L_PAREN "("
        WHITESPACE "\n      "
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "1"
        WHITESPACE "\n   "
        R_PAREN ")"
      WHITESPACE " "
      COMMENT "-- <-- missing a comma"
      WHITESPACE "\n   "
      WITH_TABLE
        NAME
          ROW_KW "row"
        WHITESPACE " "
        AS_KW "as"
        WHITESPACE " "
        L_PAREN "("
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "1"
        R_PAREN ")"
    WHITESPACE "\n"
    SELECT_CLAUSE
      SELECT_KW "select"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          LITERAL
            INT_NUMBER "1"
  SEMICOLON ";"
  WHITESPACE "\n\n\n"
  COMMENT "-- extra comma with values (we didn't support values before)"
  WHITESPACE "\n"
  VALUES
    WITH_CLAUSE
      WITH_KW "with"
      WHITESPACE " \n   "
      WITH_TABLE
        NAME
          IDENT "a"
        WHITESPACE " "
        AS_KW "as"
        WHITESPACE " "
        L_PAREN "("
        WHITESPACE "\n      "
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "1"
        WHITESPACE "\n   "
        R_PAREN ")"
      ERROR
        COMMA ","
    WHITESPACE " "
    COMMENT "-- <-- extra comma"
    WHITESPACE "\n"
    VALUES_KW "values"
    WHITESPACE " "
    ROW_LIST
      ROW
        L_PAREN "("
        LITERAL
          INT_NUMBER "2"
        R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n"
---
error[syntax-error]: unexpected comma
  ╭▸ 
3 │ ), -- <--- extra comma!
  ╰╴ ━
error[syntax-error]: unexpected comma, expected a column name
  ╭▸ 
8 │ search depth first by a, , c set ordercol
  ╰╴                         ━
error[syntax-error]: expected COMMA
   ╭▸ 
13 │ search depth first by a, b c set ordercol
   ╰╴                          ━
error[syntax-error]: unexpected WITH
   ╭▸ 
18 │ with f as (select 2)
   ╰╴━
error[syntax-error]: missing comma
   ╭▸ 
24 │    ) -- <-- missing a comma
   ╰╴    ━
error[syntax-error]: missing comma
   ╭▸ 
34 │    ) -- <-- missing a comma
   ╰╴    ━
error[syntax-error]: unexpected comma
   ╭▸ 
43 │    ), -- <-- extra comma
   ╰╴    ━
