const E = {
  comments: {
    lineComment: "--",
    blockComment: ["/*", "*/"]
  },
  brackets: [
    ["{", "}"],
    ["[", "]"],
    ["(", ")"]
  ],
  autoClosingPairs: [
    { open: "{", close: "}" },
    { open: "[", close: "]" },
    { open: "(", close: ")" },
    { open: '"', close: '"' },
    { open: "'", close: "'" }
  ],
  surroundingPairs: [
    { open: "{", close: "}" },
    { open: "[", close: "]" },
    { open: "(", close: ")" },
    { open: '"', close: '"' },
    { open: "'", close: "'" }
  ]
}, T = {
  defaultToken: "",
  tokenPostfix: ".sql",
  ignoreCase: !0,
  brackets: [
    { open: "[", close: "]", token: "delimiter.square" },
    { open: "(", close: ")", token: "delimiter.parenthesis" }
  ],
  keywords: [
    // from https://docs.snowflake.com/en/sql-reference/reserved-keywords
    "ACCOUNT",
    "ALL",
    "ALTER",
    "AND",
    "ANY",
    "AS",
    "ASC",
    "BETWEEN",
    "BY",
    "CASE",
    "CAST",
    "CHECK",
    "COLUMN",
    "CONNECT",
    "CREATE",
    "CURRENT",
    "DELETE",
    "DESC",
    "DISTINCT",
    "DROP",
    "DISTINCT",
    "ELSE",
    "EXISTS",
    "FALSE",
    "FOLLOWING",
    "FOR",
    "FROM",
    "FULL",
    "GRANT",
    "GROUP",
    "HAVING",
    "ILIKE",
    "IN",
    "INCREMENT",
    "INNER",
    "INSERT",
    "INTERSECT",
    "INTO",
    "IS",
    "JOIN",
    "LATERAL",
    "LEFT",
    "LIKE",
    "MINUS",
    "NATURAL",
    "NOT",
    "NULL",
    "OF",
    "ON",
    "OR",
    "ORDER",
    "OUTER",
    "QUALIFY",
    "REGEXP",
    "REVOKE",
    "RIGHT",
    "RLIKE",
    "ROW",
    "ROWS",
    "SAMPLE",
    "SELECT",
    "SET",
    "SOME",
    "START",
    "TABLE",
    "TABLESAMPLE",
    "THEN",
    "TO",
    "TRIGGER",
    "TRUE",
    "TRY_CAST",
    "UNION",
    "UNIQUE",
    "UPDATE",
    "USING",
    "VALUES",
    "VIEW",
    "WHEN",
    "WHENEVER",
    "WHERE",
    "WITH"
  ],
  operators: [
    // from https://docs.snowflake.com/en/sql-reference/operators
    // also some stuff from keywords as most poeple use them only
    // as operators, and we want consistent coloring
    "AND",
    "NOT",
    "OR",
    "INTERSECT",
    "MINUS",
    "EXCEPT",
    "UNION",
    "UNION",
    "ALL",
    "ANY",
    "EXISTS",
    "IN",
    "BETWEEN",
    "IS",
    "NULL"
  ],
  builtinFunctions: [
    /*
          from https://docs.snowflake.com/en/sql-reference/functions-all, using following script:
    
          ```
          a = [];
          for (const elem of document.getElementsByTagName('table')[0].getElementsByTagName('tbody')[0].getElementsByTagName('tr')) {
            if (elem.children[0].children[0].children[0].tagName === 'A') {
                a.push(elem.children[0].children[0].innerText);
            }
          }
          console.log(JSON.stringify(a, null, 2));
          ```
    
          with then a manual sort done after some minor clean-up, where some lines have multiple
          functions.
        */
    "ABS",
    "ACOS",
    "ACOSH",
    "ADD_MONTHS",
    "ALERT_HISTORY",
    "ALL_USER_NAMES",
    "ANY_VALUE",
    "APPROXIMATE_JACCARD_INDEX",
    "APPROXIMATE_SIMILARITY",
    "APPROX_COUNT_DISTINCT",
    "APPROX_PERCENTILE",
    "APPROX_PERCENTILE_ACCUMULATE",
    "APPROX_PERCENTILE_COMBINE",
    "APPROX_PERCENTILE_ESTIMATE",
    "APPROX_TOP_K",
    "APPROX_TOP_K_ACCUMULATE",
    "APPROX_TOP_K_COMBINE",
    "APPROX_TOP_K_ESTIMATE",
    "ARRAYS_OVERLAP",
    "ARRAY_AGG",
    "ARRAY_APPEND",
    "ARRAY_CAT",
    "ARRAY_COMPACT",
    "ARRAY_CONSTRUCT",
    "ARRAY_CONSTRUCT_COMPACT",
    "ARRAY_CONTAINS",
    "ARRAY_DISTINCT",
    "ARRAY_EXCEPT",
    "ARRAY_GENERATE_RANGE",
    "ARRAY_INSERT",
    "ARRAY_INTERSECTION",
    "ARRAY_MAX",
    "ARRAY_MIN",
    "ARRAY_POSITION",
    "ARRAY_PREPEND",
    "ARRAY_REMOVE",
    "ARRAY_REMOVE_AT",
    "ARRAY_SIZE",
    "ARRAY_SLICE",
    "ARRAY_SORT",
    "ARRAY_TO_STRING",
    "ARRAY_UNION_AGG",
    "ARRAY_UNIQUE_AGG",
    "ASCII",
    "ASIN",
    "ASINH",
    "AS_ARRAY",
    "AS_BINARY",
    "AS_BOOLEAN",
    "AS_CHAR",
    "AS_DATE",
    "AS_DECIMAL",
    "AS_DOUBLE",
    "AS_INTEGER",
    "AS_NUMBER",
    "AS_OBJECT",
    "AS_REAL",
    "AS_TIME",
    "AS_TIMESTAMP_LTZ",
    "AS_TIMESTAMP_NTZ",
    "AS_TIMESTAMP_TZ",
    "AS_VARCHAR",
    "ATAN",
    "ATAN2",
    "ATANH",
    "AUTOMATIC_CLUSTERING_HISTORY",
    "AUTO_REFRESH_REGISTRATION_HISTORY",
    "AVG",
    "BASE64_DECODE_BINARY",
    "BASE64_DECODE_STRING",
    "BASE64_ENCODE",
    "BITAND",
    "BITAND_AGG",
    "BITMAP_BIT_POSITION",
    "BITMAP_BUCKET_NUMBER",
    "BITMAP_CONSTRUCT_AGG",
    "BITMAP_COUNT",
    "BITMAP_OR_AGG",
    "BITNOT",
    "BITOR",
    "BITOR_AGG",
    "BITSHIFTLEFT",
    "BITSHIFTRIGHT",
    "BITXOR",
    "BITXOR_AGG",
    "BIT_LENGTH",
    "BOOLAND",
    "BOOLAND_AGG",
    "BOOLNOT",
    "BOOLOR",
    "BOOLOR_AGG",
    "BOOLXOR",
    "BOOLXOR_AGG",
    "BUILD_SCOPED_FILE_URL",
    "BUILD_STAGE_FILE_URL",
    "CASE",
    "CAST",
    "CBRT",
    "CEIL",
    "CHAR",
    "CHARINDEX",
    "CHECK_JSON",
    "CHECK_XML",
    "CHR",
    "CLEANUP_DATABASE_ROLE_GRANTS",
    "COALESCE",
    "COLLATE",
    "COLLATION",
    "COMPLETE_TASK_GRAPHS",
    "COMPRESS",
    "CONCAT",
    "CONCAT_WS",
    "CONDITIONAL_CHANGE_EVENT",
    "CONDITIONAL_TRUE_EVENT",
    "CONTAINS",
    "CONVERT_TIMEZONE",
    "COPY_HISTORY",
    "CORR",
    "COS",
    "COSH",
    "COT",
    "COUNT",
    "COUNT_IF",
    "COVAR_POP",
    "COVAR_SAMP",
    "CUME_DIST",
    "CURRENT_ACCOUNT",
    "CURRENT_AVAILABLE_ROLES",
    "CURRENT_CLIENT",
    "CURRENT_DATABASE",
    "CURRENT_DATE",
    "CURRENT_IP_ADDRESS",
    "CURRENT_ORGANIZATION_NAME",
    "CURRENT_REGION",
    "CURRENT_ROLE",
    "CURRENT_ROLE_TYPE",
    "CURRENT_SCHEMA",
    "CURRENT_SCHEMAS",
    "CURRENT_SECONDARY_ROLES",
    "CURRENT_SESSION",
    "CURRENT_STATEMENT",
    "CURRENT_TASK_GRAPHS",
    "CURRENT_TIME",
    "CURRENT_TIMESTAMP",
    "CURRENT_TRANSACTION",
    "CURRENT_USER",
    "CURRENT_VERSION",
    "CURRENT_WAREHOUSE",
    "DATABASE_REFRESH_HISTORY",
    "DATABASE_REFRESH_PROGRESS",
    "DATABASE_REFRESH_PROGRESS_BY_JOB",
    "DATABASE_REPLICATION_USAGE_HISTORY",
    "DATABASE_STORAGE_USAGE_HISTORY",
    "DATA_TRANSFER_HISTORY",
    "DATE",
    "DATEADD",
    "DATEDIFF",
    "DATE_FROM_PARTS",
    "DATE_PART",
    "DATE_TRUNC",
    "DAY",
    "DAYNAME",
    "DAYOFMONTH",
    "DAYOFWEEK",
    "DAYOFWEEKISO",
    "DAYOFYEAR",
    "DECODE",
    "DECOMPRESS_BINARY",
    "DECOMPRESS_STRING",
    "DECRYPT",
    "DECRYPT_RAW",
    "DEGREES",
    "DENSE_RANK",
    "DIV0",
    "DIV0NULL",
    "DYNAMIC_TABLE_GRAPH_HISTORY",
    "DYNAMIC_TABLE_REFRESH_HISTORY",
    "EDITDISTANCE",
    "ENCRYPT",
    "ENCRYPT_RAW",
    "ENDSWITH",
    "EQUAL_NULL",
    "EXP",
    "EXPLAIN_JSON",
    "EXTERNAL_FUNCTIONS_HISTORY",
    "EXTERNAL_TABLE_FILES",
    "EXTERNAL_TABLE_FILE_REGISTRATION_HISTORY",
    "EXTRACT",
    "EXTRACT_SEMANTIC_CATEGORIES",
    "FACTORIAL",
    "FIRST_VALUE",
    "FLATTEN",
    "FLOOR",
    "GENERATE_COLUMN_DESCRIPTION",
    "GENERATOR",
    "GET",
    "GETBIT",
    "GETVARIABLE",
    "GET_ABSOLUTE_PATH",
    "GET_DDL",
    "GET_IGNORE_CASE",
    "GET_OBJECT_REFERENCES",
    "GET_PATH",
    "GET_PRESIGNED_URL",
    "GET_QUERY_OPERATOR_STATS",
    "GET_RELATIVE_PATH",
    "GET_STAGE_LOCATION",
    "GREATEST",
    "GROUPING",
    "GROUPING_ID",
    "HASH",
    "HASH_AGG",
    "HAVERSINE",
    "HEX_DECODE_BINARY",
    "HEX_DECODE_STRING",
    "HEX_ENCODE",
    "HLL",
    "HLL_ACCUMULATE",
    "HLL_COMBINE",
    "HLL_ESTIMATE",
    "HLL_EXPORT",
    "HLL_IMPORT",
    "HOUR",
    "IFF",
    "IFNULL",
    "INFER_SCHEMA",
    "INITCAP",
    "INSERT",
    "INVOKER_ROLE",
    "INVOKER_SHARE",
    "IS_ARRAY",
    "IS_BINARY",
    "IS_BOOLEAN",
    "IS_CHAR",
    "IS_DATE",
    "IS_DATE_VALUE",
    "IS_DECIMAL",
    "IS_DOUBLE",
    "IS_GRANTED_TO_INVOKER_ROLE",
    "IS_INTEGER",
    "IS_NULL_VALUE",
    "IS_OBJECT",
    "IS_REAL",
    "IS_ROLE_IN_SESSION",
    "IS_TIME",
    "IS_TIMESTAMP_LTZ",
    "IS_TIMESTAMP_NTZ",
    "IS_TIMESTAMP_TZ",
    "IS_VARCHAR",
    "JAROWINKLER_SIMILARITY",
    "JSON_EXTRACT_PATH_TEXT",
    "KURTOSIS",
    "LAG",
    "LAST_DAY",
    "LAST_QUERY_ID",
    "LAST_SUCCESSFUL_SCHEDULED_TIME",
    "LAST_TRANSACTION",
    "LAST_VALUE",
    "LEAD",
    "LEAST",
    "LEFT",
    "LEN",
    "LENGTH",
    "LISTAGG",
    "LN",
    "LOCALTIME",
    "LOCALTIMESTAMP",
    "LOG",
    "LOGIN_HISTORY",
    "LOGIN_HISTORY_BY_USER",
    "LOWER",
    "LPAD",
    "LTRIM",
    "MATERIALIZED_VIEW_REFRESH_HISTORY",
    "MAX",
    "MAX_BY",
    "MD5",
    "MD5_BINARY",
    "MD5_HEX",
    "MD5_NUMBER",
    "MD5_NUMBER_LOWER64",
    "MD5_NUMBER_UPPER64",
    "MEDIAN",
    "MIN",
    "MINHASH",
    "MINHASH_COMBINE",
    "MINUTE",
    "MIN_BY",
    "MOD",
    "MODE",
    "MONTH",
    "MONTHNAME",
    "MONTHS_BETWEEN",
    "NEXT_DAY",
    "NORMAL",
    "NOTIFICATION_HISTORY",
    "NTH_VALUE",
    "NTILE",
    "NULLIF",
    "NULLIFZERO",
    "NVL",
    "NVL2",
    "OBJECT_AGG",
    "OBJECT_CONSTRUCT",
    "OBJECT_CONSTRUCT_KEEP_NULL",
    "OBJECT_DELETE",
    "OBJECT_INSERT",
    "OBJECT_KEYS",
    "OBJECT_PICK",
    "OCTET_LENGTH",
    "PARSE_IP",
    "PARSE_JSON",
    "PARSE_URL",
    "PARSE_XML",
    "PERCENTILE_CONT",
    "PERCENTILE_DISC",
    "PERCENT_RANK",
    "PI",
    "PIPE_USAGE_HISTORY",
    "POLICY_CONTEXT",
    "POLICY_REFERENCES",
    "POSITION",
    "POW",
    "POWER",
    "PREVIOUS_DAY",
    "QUARTER",
    "QUERY_ACCELERATION_HISTORY",
    "QUERY_HISTORY",
    "QUERY_HISTORY_BY_SESSION",
    "QUERY_HISTORY_BY_USER",
    "QUERY_HISTORY_BY_WAREHOUSE",
    "RADIANS",
    "RANDOM",
    "RANDSTR",
    "RANK",
    "RATIO_TO_REPORT",
    "REGEXP_COUNT",
    "REGEXP_INSTR",
    "REGEXP_LIKE",
    "REGEXP_REPLACE",
    "REGEXP_SUBSTR",
    "REGEXP_SUBSTR_ALL",
    "REGR_AVGX",
    "REGR_AVGY",
    "REGR_COUNT",
    "REGR_INTERCEPT",
    "REGR_R2",
    "REGR_SLOPE",
    "REGR_SXX",
    "REGR_SXY",
    "REGR_SYY",
    "REGR_VALX",
    "REGR_VALY",
    "REPEAT",
    "REPLACE",
    "REPLICATION_GROUP_REFRESH_HISTORY",
    "REPLICATION_GROUP_REFRESH_PROGRESS",
    "REPLICATION_GROUP_REFRESH_PROGRESS_BY_JOB",
    "REPLICATION_GROUP_USAGE_HISTORY",
    "REPLICATION_USAGE_HISTORY",
    "REST_EVENT_HISTORY",
    "RESULT_SCAN",
    "REVERSE",
    "RIGHT",
    "RLIKE",
    "ROUND",
    "ROW_NUMBER",
    "RPAD",
    "RTRIM",
    "RTRIMMED_LENGTH",
    "SCHEDULED_TIME",
    "SEARCH_OPTIMIZATION_HISTORY",
    "SECOND",
    "SEQ1",
    "SEQ2",
    "SEQ4",
    "SEQ8",
    "SERVERLESS_TASK_HISTORY",
    "SHA1",
    "SHA1_BINARY",
    "SHA1_HEX",
    "SHA2",
    "SHA2_BINARY",
    "SHA2_HEX",
    "SIGN",
    "SIN",
    "SINH",
    "SKEW",
    "SOUNDEX",
    "SOUNDEX_P123",
    "SPACE",
    "SPLIT",
    "SPLIT_PART",
    "SPLIT_TO_TABLE",
    "SQRT",
    "SQUARE",
    "STAGE_DIRECTORY_FILE_REGISTRATION_HISTORY",
    "STAGE_STORAGE_USAGE_HISTORY",
    "STARTSWITH",
    "STDDEV",
    "STDDEV_POP",
    "STDDEV_SAMP",
    "STRIP_NULL_VALUE",
    "STRTOK",
    "STRTOK_SPLIT_TO_TABLE",
    "STRTOK_TO_ARRAY",
    "ST_AREA",
    "ST_ASBINARY",
    "ST_ASEWKB",
    "ST_ASEWKT",
    "ST_ASGEOJSON",
    "ST_ASTEXT",
    "ST_ASWKB",
    "ST_ASWKT",
    "ST_AZIMUTH",
    "ST_BUFFER",
    "ST_CENTROID",
    "ST_COLLECT",
    "ST_CONTAINS",
    "ST_COVEREDBY",
    "ST_COVERS",
    "ST_DIFFERENCE",
    "ST_DIMENSION",
    "ST_DISJOINT",
    "ST_DISTANCE",
    "ST_DWITHIN",
    "ST_ENDPOINT",
    "ST_ENVELOPE",
    "ST_GEOGFROMGEOHASH",
    "ST_GEOGPOINTFROMGEOHASH",
    "ST_GEOGRAPHYFROMWKB",
    "ST_GEOGRAPHYFROMWKT",
    "ST_GEOHASH",
    "ST_GEOMETRYFROMWKB",
    "ST_GEOMETRYFROMWKT",
    "ST_GEOM_POINT",
    "ST_HAUSDORFFDISTANCE",
    "ST_INTERSECTION",
    "ST_INTERSECTS",
    "ST_ISVALID",
    "ST_LENGTH",
    "ST_MAKEGEOMPOINT",
    "ST_MAKELINE",
    "ST_MAKEPOINT",
    "ST_MAKEPOLYGON",
    "ST_MAKEPOLYGONORIENTED",
    "ST_NPOINTS",
    "ST_NUMPOINTS",
    "ST_PERIMETER",
    "ST_POINT",
    "ST_POINTN",
    "ST_POLYGON",
    "ST_SETSRID",
    "ST_SIMPLIFY",
    "ST_SRID",
    "ST_STARTPOINT",
    "ST_SYMDIFFERENCE",
    "ST_TRANSFORM",
    "ST_UNION",
    "ST_WITHIN",
    "ST_X",
    "ST_XMAX",
    "ST_XMIN",
    "ST_Y",
    "ST_YMAX",
    "ST_YMIN",
    "SUBSTR",
    "SUBSTRING",
    "SUM",
    "SYSDATE",
    "SYSTEM$ABORT_SESSION",
    "SYSTEM$ABORT_TRANSACTION",
    "SYSTEM$ADD_EVENT",
    "SYSTEM$ALLOWLIST",
    "SYSTEM$ALLOWLIST_PRIVATELINK",
    "SYSTEM$AUTHORIZE_PRIVATELINK",
    "SYSTEM$AUTHORIZE_STAGE_PRIVATELINK_ACCESS",
    "SYSTEM$BEHAVIOR_CHANGE_BUNDLE_STATUS",
    "SYSTEM$BLOCK_INTERNAL_STAGES_PUBLIC_ACCESS",
    "SYSTEM$CANCEL_ALL_QUERIES",
    "SYSTEM$CANCEL_QUERY",
    "SYSTEM$CLUSTERING_DEPTH",
    "SYSTEM$CLUSTERING_INFORMATION",
    "SYSTEM$CLUSTERING_RATIO",
    "SYSTEM$CREATE_BILLING_EVENT",
    "SYSTEM$CURRENT_USER_TASK_NAME",
    "SYSTEM$DATABASE_REFRESH_HISTORY",
    "SYSTEM$DATABASE_REFRESH_PROGRESS",
    "SYSTEM$DATABASE_REFRESH_PROGRESS_BY_JOB",
    "SYSTEM$DISABLE_BEHAVIOR_CHANGE_BUNDLE",
    "SYSTEM$DISABLE_DATABASE_REPLICATION",
    "SYSTEM$ENABLE_BEHAVIOR_CHANGE_BUNDLE",
    "SYSTEM$ESTIMATE_QUERY_ACCELERATION",
    "SYSTEM$ESTIMATE_SEARCH_OPTIMIZATION_COSTS",
    "SYSTEM$EXPLAIN_JSON_TO_TEXT",
    "SYSTEM$EXPLAIN_PLAN_JSON",
    "SYSTEM$EXTERNAL_TABLE_PIPE_STATUS",
    "SYSTEM$GENERATE_SAML_CSR",
    "SYSTEM$GENERATE_SCIM_ACCESS_TOKEN",
    "SYSTEM$GET_AWS_SNS_IAM_POLICY",
    "SYSTEM$GET_CMK_AKV_CONSENT_URL",
    "SYSTEM$GET_CMK_KMS_KEY_POLICY",
    "SYSTEM$GET_GCP_KMS_CMK_GRANT_ACCESS_CMD",
    "SYSTEM$GET_LOGIN_FAILURE_DETAILS",
    "SYSTEM$GET_PREDECESSOR_RETURN_VALUE",
    "SYSTEM$GET_PRIVATELINK",
    "SYSTEM$GET_PRIVATELINK_AUTHORIZED_ENDPOINTS",
    "SYSTEM$GET_PRIVATELINK_CONFIG",
    "SYSTEM$GET_SNOWFLAKE_PLATFORM_INFO",
    "SYSTEM$GET_TAG",
    "SYSTEM$GET_TAG_ALLOWED_VALUES",
    "SYSTEM$GET_TAG_ON_CURRENT_COLUMN",
    "SYSTEM$GET_TAG_ON_CURRENT_TABLE",
    "SYSTEM$GET_TASK_GRAPH_CONFIG",
    "SYSTEM$GLOBAL_ACCOUNT_SET_PARAMETER",
    "SYSTEM$INTERNAL_STAGES_PUBLIC_ACCESS_STATUS",
    "SYSTEM$LAST_CHANGE_COMMIT_TIME",
    "SYSTEM$LINK_ACCOUNT_OBJECTS_BY_NAME",
    "SYSTEM$LOG",
    "SYSTEM$LOG_DEBUG",
    "SYSTEM$LOG_ERROR",
    "SYSTEM$LOG_FATAL",
    "SYSTEM$LOG_INFO",
    "SYSTEM$LOG_TRACE",
    "SYSTEM$LOG_WARN",
    "SYSTEM$MIGRATE_SAML_IDP_REGISTRATION",
    "SYSTEM$PIPE_FORCE_RESUME",
    "SYSTEM$PIPE_STATUS",
    "SYSTEM$QUERY_REFERENCE",
    "SYSTEM$REFERENCE",
    "SYSTEM$REVOKE_PRIVATELINK",
    "SYSTEM$REVOKE_STAGE_PRIVATELINK_ACCESS",
    "SYSTEM$SET_RETURN_VALUE",
    "SYSTEM$SET_SPAN_ATTRIBUTES",
    "SYSTEM$SHOW_OAUTH_CLIENT_SECRETS",
    "SYSTEM$STREAM_BACKLOG",
    "SYSTEM$STREAM_GET_TABLE_TIMESTAMP",
    "SYSTEM$STREAM_HAS_DATA",
    "SYSTEM$TASK_DEPENDENTS_ENABLE",
    "SYSTEM$TYPEOF",
    "SYSTEM$UNBLOCK_INTERNAL_STAGES_PUBLIC_ACCESS",
    "SYSTEM$USER_TASK_CANCEL_ONGOING_EXECUTIONS",
    "SYSTEM$VERIFY_EXTERNAL_OAUTH_TOKEN",
    "SYSTEM$WAIT",
    "SYSTEM$WHITELIST",
    "SYSTEM$WHITELIST_PRIVATELINK",
    "TAG_REFERENCES",
    "TAG_REFERENCES_ALL_COLUMNS",
    "TAG_REFERENCES_WITH_LINEAGE",
    "TAN",
    "TANH",
    "TASK_DEPENDENTS",
    "TASK_HISTORY",
    "TIME",
    "TIMEADD",
    "TIMEDIFF",
    "TIMESTAMPADD",
    "TIMESTAMPDIFF",
    "TIMESTAMP_FROM_PARTS",
    "TIME_FROM_PARTS",
    "TIME_SLICE",
    "TOP_INSIGHTS",
    "TO_ARRAY",
    "TO_BINARY",
    "TO_BOOLEAN",
    "TO_CHAR",
    "TO_DATE",
    "TO_DECIMAL",
    "TO_DOUBLE",
    "TO_GEOGRAPHY",
    "TO_GEOMETRY",
    "TO_JSON",
    "TO_NUMBER",
    "TO_NUMERIC",
    "TO_OBJECT",
    "TO_TIME",
    "TO_TIMESTAMP",
    "TO_TIMESTAMP_LTZ",
    "TO_TIMESTAMP_NTZ",
    "TO_TIMESTAMP_TZ",
    "TO_VARCHAR",
    "TO_VARIANT",
    "TO_XML",
    "TRANSLATE",
    "TRIM",
    "TRUNC",
    "TRUNCATE",
    "TRY_BASE64_DECODE_BINARY",
    "TRY_BASE64_DECODE_STRING",
    "TRY_CAST",
    "TRY_HEX_DECODE_BINARY",
    "TRY_HEX_DECODE_STRING",
    "TRY_PARSE_JSON",
    "TRY_TO_BINARY",
    "TRY_TO_BOOLEAN",
    "TRY_TO_DATE",
    "TRY_TO_DECIMAL",
    "TRY_TO_DOUBLE",
    "TRY_TO_GEOGRAPHY",
    "TRY_TO_GEOMETRY",
    "TRY_TO_NUMBER",
    "TRY_TO_NUMERIC",
    "TRY_TO_TIME",
    "TRY_TO_TIMESTAMP",
    "TRY_TO_TIMESTAMP_LTZ",
    "TRY_TO_TIMESTAMP_NTZ",
    "TRY_TO_TIMESTAMP_TZ",
    "TYPEOF",
    "UNICODE",
    "UNIFORM",
    "UPPER",
    "UUID_STRING",
    "VALIDATE",
    "VALIDATE_PIPE_LOAD",
    "VARIANCE",
    "VARIANCE_POP",
    "VARIANCE_SAMP",
    "VAR_POP",
    "VAR_SAMP",
    "WAREHOUSE_LOAD_HISTORY",
    "WAREHOUSE_METERING_HISTORY",
    "WEEK",
    "WEEKISO",
    "WEEKOFYEAR",
    "WIDTH_BUCKET",
    "XMLGET",
    "YEAR",
    "YEAROFWEEK",
    "YEAROFWEEKISO",
    "ZEROIFNULL",
    "ZIPF"
  ],
  builtinVariables: [
    // NOT SUPPORTED
  ],
  pseudoColumns: [
    // NOT SUPPORTED
  ],
  tokenizer: {
    root: [
      { include: "@comments" },
      { include: "@whitespace" },
      { include: "@pseudoColumns" },
      { include: "@numbers" },
      { include: "@strings" },
      { include: "@complexIdentifiers" },
      { include: "@scopes" },
      [/[;,.]/, "delimiter"],
      [/[()]/, "@brackets"],
      [
        /[\w@#$]+/,
        {
          cases: {
            "@operators": "operator",
            "@builtinVariables": "predefined",
            "@builtinFunctions": "predefined",
            "@keywords": "keyword",
            "@default": "identifier"
          }
        }
      ],
      [/[<>=!%&+\-*/|~^]/, "operator"]
    ],
    whitespace: [[/\s+/, "white"]],
    comments: [
      [/--+.*/, "comment"],
      [/\/\/.*/, "comment"],
      [/\/\*/, { token: "comment.quote", next: "@comment" }]
    ],
    comment: [
      [/[^*/]+/, "comment"],
      // Not supporting nested comments, as nested comments seem to not be standard?
      // i.e. http://stackoverflow.com/questions/728172/are-there-multiline-comment-delimiters-in-sql-that-are-vendor-agnostic
      // [/\/\*/, { token: 'comment.quote', next: '@push' }],    // nested comment not allowed :-(
      [/\*\//, { token: "comment.quote", next: "@pop" }],
      [/./, "comment"]
    ],
    pseudoColumns: [
      [
        /[$][A-Za-z_][\w@#$]*/,
        {
          cases: {
            "@pseudoColumns": "predefined",
            "@default": "identifier"
          }
        }
      ]
    ],
    numbers: [
      [/0[xX][0-9a-fA-F]*/, "number"],
      [/[$][+-]*\d*(\.\d*)?/, "number"],
      [/((\d+(\.\d*)?)|(\.\d+))([eE][-+]?\d+)?/, "number"]
    ],
    strings: [[/'/, { token: "string", next: "@string" }]],
    string: [
      [/[^']+/, "string"],
      [/''/, "string"],
      [/'/, { token: "string", next: "@pop" }]
    ],
    complexIdentifiers: [
      [/"/, { token: "identifier.quote", next: "@quotedIdentifier" }]
    ],
    quotedIdentifier: [
      [/[^"]+/, "identifier"],
      [/""/, "identifier"],
      [/"/, { token: "identifier.quote", next: "@pop" }]
    ],
    scopes: [
      // NOT SUPPORTED
    ]
  }
};
export {
  E as conf,
  T as language
};
//# sourceMappingURL=snowflake-Dhhg1zNw.mjs.map
