---
source: crates/squawk_parser/tests/tests.rs
input_file: crates/squawk_parser/tests/data/ok/create_aggregate.sql
---
SOURCE_FILE
  COMMENT "-- simple_old_syntax"
  WHITESPACE "\n"
  CREATE_AGGREGATE
    CREATE_KW "create"
    WHITESPACE " "
    AGGREGATE_KW "aggregate"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "a"
    WHITESPACE " "
    ATTRIBUTE_LIST
      L_PAREN "("
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "basetype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "t"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "f"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "stype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "u"
      WHITESPACE "\n"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- full_old_syntax"
  WHITESPACE "\n"
  CREATE_AGGREGATE
    CREATE_KW "create"
    WHITESPACE " "
    OR_REPLACE
      OR_KW "or"
      WHITESPACE " "
      REPLACE_KW "replace"
    WHITESPACE " "
    AGGREGATE_KW "aggregate"
    WHITESPACE " "
    PATH
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "foo"
      DOT "."
      PATH_SEGMENT
        NAME
          IDENT "my_aggregate"
    WHITESPACE " "
    ATTRIBUTE_LIST
      L_PAREN "("
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "basetype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "foo"
              DOT "."
              PATH_SEGMENT
                NAME_REF
                  IDENT "input_type"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "foo"
              DOT "."
              PATH_SEGMENT
                NAME_REF
                  IDENT "state_function"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "stype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "foo"
              DOT "."
              PATH_SEGMENT
                NAME_REF
                  IDENT "state_type"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sspace"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            INT_NUMBER "1024"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "foo"
              DOT "."
              PATH_SEGMENT
                NAME_REF
                  IDENT "final_function"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc_extra"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            TRUE_KW "true"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc_modify"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "read_only"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "combinefunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "foo"
              DOT "."
              PATH_SEGMENT
                NAME_REF
                  IDENT "combine_function"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "serialfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "foo"
              DOT "."
              PATH_SEGMENT
                NAME_REF
                  IDENT "serial_function"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "deserialfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "foo"
              DOT "."
              PATH_SEGMENT
                NAME_REF
                  IDENT "deserial_function"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "initcond"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            STRING "'0'"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "msfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "foo"
              DOT "."
              PATH_SEGMENT
                NAME_REF
                  IDENT "moving_state_function"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "minvfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "foo"
              DOT "."
              PATH_SEGMENT
                NAME_REF
                  IDENT "moving_inverse_function"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "mstype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "foo"
              DOT "."
              PATH_SEGMENT
                NAME_REF
                  IDENT "moving_state_type"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "msspace"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            INT_NUMBER "2048"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "mfinalfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH
                PATH_SEGMENT
                  NAME_REF
                    IDENT "foo"
              DOT "."
              PATH_SEGMENT
                NAME_REF
                  IDENT "moving_final_function"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "mfinalfunc_extra"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            TRUE_KW "true"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "mfinalfunc_modify"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "shareable"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "minitcond"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            STRING "'{\"initial\":\"value\"}'"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sortop"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          L_ANGLE "<"
      WHITESPACE "\n"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- simple"
  WHITESPACE "\n"
  CREATE_AGGREGATE
    CREATE_KW "create"
    WHITESPACE " "
    AGGREGATE_KW "aggregate"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "a"
    PARAM_LIST
      L_PAREN "("
      PARAM
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "t"
      R_PAREN ")"
    WHITESPACE " "
    ATTRIBUTE_LIST
      L_PAREN "("
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "f"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "stype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "t"
      WHITESPACE "\n"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- full"
  WHITESPACE "\n"
  CREATE_AGGREGATE
    CREATE_KW "create"
    WHITESPACE " "
    OR_REPLACE
      OR_KW "or"
      WHITESPACE " "
      REPLACE_KW "replace"
    WHITESPACE " "
    AGGREGATE_KW "aggregate"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "a"
    PARAM_LIST
      L_PAREN "("
      PARAM
        PARAM_IN
          IN_KW "in"
        WHITESPACE " "
        NAME
          IDENT "a"
        WHITESPACE " "
        PATH_TYPE
          PATH
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "p"
            DOT "."
            PATH_SEGMENT
              NAME_REF
                IDENT "bar"
      COMMA ","
      WHITESPACE " "
      PARAM
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                TEXT_KW "text"
      COMMA ","
      WHITESPACE " "
      PARAM
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                SMALLINT_KW "smallint"
      R_PAREN ")"
    WHITESPACE " "
    ATTRIBUTE_LIST
      L_PAREN "("
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "f"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "stype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "t"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sspace"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            INT_NUMBER "1024"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "ff"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc_extra"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc_modify"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "read_only"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "combinefunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "cf"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "serialfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "sf"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "deserialfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "df"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "initcond"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            STRING "'0'"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "msfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "msf"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "minvfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "mif"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "mstype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "mt"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "msspace"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            INT_NUMBER "2048"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "mfinalfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "mff"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "mfinalfunc_extra"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "mfinalfunc_modify"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "shareable"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "minitcond"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            STRING "'{\"initial\":\"value\"}'"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sortop"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          L_ANGLE "<"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          PARALLEL_KW "parallel"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "safe"
      WHITESPACE "\n"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- ordered_aggregate"
  WHITESPACE "\n"
  CREATE_AGGREGATE
    CREATE_KW "create"
    WHITESPACE " "
    OR_REPLACE
      OR_KW "or"
      WHITESPACE " "
      REPLACE_KW "replace"
    WHITESPACE " "
    AGGREGATE_KW "aggregate"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "percentile_disc"
    PARAM_LIST
      L_PAREN "("
      WHITESPACE "\n  "
      PARAM
        PARAM_IN
          IN_KW "in"
        WHITESPACE " "
        NAME
          IDENT "p1"
        WHITESPACE " "
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "float8"
      COMMA ","
      WHITESPACE "\n"
      COMMENT "--   in p2 text ORDER BY in value1 anyelement,"
      WHITESPACE "\n  "
      PARAM
        PARAM_IN
          IN_KW "in"
        WHITESPACE " "
        NAME
          IDENT "value2"
        WHITESPACE " "
        TIME_TYPE
          TIMESTAMP_KW "timestamp"
      WHITESPACE " "
      ORDER_KW "ORDER"
      WHITESPACE " "
      BY_KW "BY"
      WHITESPACE " "
      PARAM
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "a"
      COMMA ","
      WHITESPACE "\n  "
      PARAM
        NAME
          IDENT "result"
        WHITESPACE " "
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                NUMERIC_KW "numeric"
      WHITESPACE "\n"
      R_PAREN ")"
    WHITESPACE " "
    ATTRIBUTE_LIST
      L_PAREN "("
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "percentile_disc_transition"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "stype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "internal"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sspace"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            INT_NUMBER "1024"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "percentile_disc_final"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc_extra"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc_modify"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "read_only"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "initcond"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            STRING "'0.5'"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          PARALLEL_KW "parallel"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "safe"
      COMMA ","
      WHITESPACE "\n  "
      ATTRIBUTE_OPTION
        NAME
          IDENT "hypothetical"
      WHITESPACE "\n"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- doc_example_1"
  WHITESPACE "\n"
  CREATE_AGGREGATE
    CREATE_KW "CREATE"
    WHITESPACE " "
    AGGREGATE_KW "AGGREGATE"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "array_accum"
    WHITESPACE " "
    PARAM_LIST
      L_PAREN "("
      PARAM
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "anycompatible"
      R_PAREN ")"
    WHITESPACE "\n"
    ATTRIBUTE_LIST
      L_PAREN "("
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "array_append"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "stype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "anycompatiblearray"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "initcond"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            STRING "'{}'"
      WHITESPACE "\n"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- doc_example_2"
  WHITESPACE "\n"
  CREATE_AGGREGATE
    CREATE_KW "CREATE"
    WHITESPACE " "
    AGGREGATE_KW "AGGREGATE"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "array_agg"
    WHITESPACE " "
    PARAM_LIST
      L_PAREN "("
      PARAM
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "anynonarray"
      R_PAREN ")"
    WHITESPACE "\n"
    ATTRIBUTE_LIST
      L_PAREN "("
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "array_agg_transfn"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "stype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "internal"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "array_agg_finalfn"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc_extra"
      WHITESPACE "\n"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- doc_example_3"
  WHITESPACE "\n"
  CREATE_AGGREGATE
    CREATE_KW "CREATE"
    WHITESPACE " "
    AGGREGATE_KW "AGGREGATE"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "percentile_disc"
    WHITESPACE " "
    PARAM_LIST
      L_PAREN "("
      PARAM
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "float8"
      WHITESPACE " "
      ORDER_KW "ORDER"
      WHITESPACE " "
      BY_KW "BY"
      WHITESPACE " "
      PARAM
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "anyelement"
      R_PAREN ")"
    WHITESPACE "\n"
    ATTRIBUTE_LIST
      L_PAREN "("
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "ordered_set_transition"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "stype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "internal"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "percentile_disc_final"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "finalfunc_extra"
      WHITESPACE "\n"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- doc_example_4"
  WHITESPACE "\n"
  CREATE_AGGREGATE
    CREATE_KW "CREATE"
    WHITESPACE " "
    AGGREGATE_KW "AGGREGATE"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "sum"
    WHITESPACE " "
    PARAM_LIST
      L_PAREN "("
      PARAM
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "complex"
      R_PAREN ")"
    WHITESPACE "\n"
    ATTRIBUTE_LIST
      L_PAREN "("
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "complex_add"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "stype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "complex"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "initcond"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            STRING "'(0,0)'"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "msfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "complex_add"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "minvfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "complex_sub"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "mstype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "complex"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "minitcond"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          LITERAL
            STRING "'(0,0)'"
      WHITESPACE "\n"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- doc_example_5"
  WHITESPACE "\n"
  CREATE_AGGREGATE
    CREATE_KW "CREATE"
    WHITESPACE " "
    AGGREGATE_KW "AGGREGATE"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "unsafe_sum"
    WHITESPACE " "
    PARAM_LIST
      L_PAREN "("
      PARAM
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "float8"
      R_PAREN ")"
    WHITESPACE "\n"
    ATTRIBUTE_LIST
      L_PAREN "("
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "stype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "float8"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "sfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "float8pl"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "mstype"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "float8"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "msfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "float8pl"
      COMMA ","
      WHITESPACE "\n    "
      ATTRIBUTE_OPTION
        NAME
          IDENT "minvfunc"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        ATTRIBUTE_VALUE
          PATH_TYPE
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "float8mi"
      WHITESPACE "\n"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
