Repository: pygments/pygments

Issue:
Add lexer for GoogleSQL/ZetaSQL
Google has a dialect of SQL known as GoogleSQL (formerly ZetaSQL), used in BigQuery and other products. It is documented at https://cloud.google.com/bigquery/googlesql.

I will add a lexer.

Discussion:

Solution patch:
diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py
index 3330c1d5..78eeed13 100644
--- a/pygments/formatters/html.py
+++ b/pygments/formatters/html.py
@@ -44,7 +44,15 @@ def webify(color):
     if color.startswith('calc') or color.startswith('var'):
         return color
     else:
-        return '#' + color
+        # Check if the color can be shortened from 6 to 3 characters
+        color = color.upper()
+        if (len(color) == 6 and
+            (    color[0] == color[1]
+             and color[2] == color[3]
+             and color[4] == color[5])):
+            return f'#{color[0]}{color[2]}{color[4]}'
+        else:
+            return f'#{color}'
 
 
 def _get_ttype_class(ttype):
diff --git a/pygments/lexers/_googlesql_builtins.py b/pygments/lexers/_googlesql_builtins.py
new file mode 100644
index 00000000..b591546c
--- /dev/null
+++ b/pygments/lexers/_googlesql_builtins.py
@@ -0,0 +1,918 @@
+"""
+    pygments.lexers._googlesql_builtins
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    Autogenerated data files for the GoogleSQL lexer.
+
+    :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
+    :license: BSD, see LICENSE for details.
+"""
+
+constants = [
+    'FALSE',
+    'NULL',
+    'TRUE',
+    'UNKNOWN',
+]
+
+# Everything below this line is auto-generated from the GoogleSQL source code.
+# ----------------------------------------------------------------------------
+
+functionnames = [
+    'ABS',
+    'ACOS',
+    'ACOSH',
+    'AEAD.DECRYPT_BYTES',
+    'AEAD.DECRYPT_STRING',
+    'AEAD.ENCRYPT',
+    'AEAD.ENVELOPE_DECRYPT_BYTES',
+    'AEAD.ENVELOPE_DECRYPT_STRING',
+    'AEAD.ENVELOPE_ENCRYPT',
+    'ALL_DIFFERENT',
+    'ANON_AVG',
+    'ANON_COUNT',
+    'ANON_COUNT',
+    'ANON_PERCENTILE_CONT',
+    'ANON_QUANTILES',
+    'ANON_STDDEV_POP',
+    'ANON_SUM',
+    'ANON_VAR_POP',
+    'ANY_VALUE',
+    'APPROX_COSINE_DISTANCE',
+    'APPROX_COUNT_DISTINCT',
+    'APPROX_DOT_PRODUCT',
+    'APPROX_EUCLIDEAN_DISTANCE',
+    'APPROX_QUANTILES',
+    'APPROX_TOP_COUNT',
+    'APPROX_TOP_SUM',
+    'ARRAY[KEY()]',
+    'ARRAY[SAFE_KEY()]',
+    'ARRAY_AGG',
+    'ARRAY_AVG',
+    'ARRAY_CONCAT',
+    'ARRAY_CONCAT_AGG',
+    'ARRAY_FILTER',
+    'ARRAY_FIND',
+    'ARRAY_FIND_ALL',
+    'ARRAY_FIRST',
+    'ARRAY_FIRST_N',
+    'ARRAY_INCLUDES',
+    'ARRAY_INCLUDES_ALL',
+    'ARRAY_INCLUDES_ANY',
+    'ARRAY_IS_DISTINCT',
+    'ARRAY_LAST',
+    'ARRAY_LAST_N',
+    'ARRAY_LENGTH',
+    'ARRAY_MAX',
+    'ARRAY_MIN',
+    'ARRAY_OFFSET',
+    'ARRAY_OFFSETS',
+    'ARRAY_REMOVE_FIRST_N',
+    'ARRAY_REMOVE_LAST_N',
+    'ARRAY_REVERSE',
+    'ARRAY_SLICE',
+    'ARRAY_SUM',
+    'ARRAY_TO_STRING',
+    'ARRAY_TRANSFORM',
+    'ARRAY_ZIP',
+    'ASCII',
+    'ASIN',
+    'ASINH',
+    'ATAN',
+    'ATAN2',
+    'ATANH',
+    'AVG',
+    'BIT_AND',
+    'BIT_COUNT',
+    'BIT_OR',
+    'BIT_XOR',
+    'BOOL',
+    'BOOL_ARRAY',
+    'BYTE_LENGTH',
+    'CASE',
+    'CAST',
+    'CBRT',
+    'CEIL',
+    'CEILING',
+    'CHARACTER_LENGTH',
+    'CHAR_LENGTH',
+    'CHR',
+    'COALESCE',
+    'CODE_POINTS_TO_BYTES',
+    'CODE_POINTS_TO_STRING',
+    'COLLATE',
+    'CONCAT',
+    'CORR',
+    'COS',
+    'COSH',
+    'COSINE_DISTANCE',
+    'COT',
+    'COTH',
+    'COUNT',
+    'COUNT(*)',
+    'COUNTIF',
+    'COVAR_POP',
+    'COVAR_SAMP',
+    'CSC',
+    'CSCH',
+    'CUME_DIST',
+    'CURRENT_DATE',
+    'CURRENT_DATETIME',
+    'CURRENT_TIME',
+    'CURRENT_TIMESTAMP',
+    'D3A_COUNT.EXTRACT',
+    'D3A_COUNT.INIT',
+    'D3A_COUNT.MERGE',
+    'D3A_COUNT.MERGE_PARTIAL',
+    'D3A_COUNT.TO_HLL',
+    'DATE',
+    'DATETIME',
+    'DATETIME_ADD',
+    'DATETIME_BUCKET',
+    'DATETIME_DIFF',
+    'DATETIME_SUB',
+    'DATETIME_TRUNC',
+    'DATE_ADD',
+    'DATE_BUCKET',
+    'DATE_DIFF',
+    'DATE_FROM_UNIX_DATE',
+    'DATE_SUB',
+    'DATE_TRUNC',
+    'DENSE_RANK',
+    'DESTINATION_NODE_ID',
+    'DETERMINISTIC_DECRYPT_BYTES',
+    'DETERMINISTIC_DECRYPT_STRING',
+    'DETERMINISTIC_ENCRYPT',
+    'DIV',
+    'DOT_PRODUCT',
+    'EDGES',
+    'EDIT_DISTANCE',
+    'ELEMENTWISE_AVG',
+    'ELEMENTWISE_SUM',
+    'ELEMENT_DEFINITION_NAME',
+    'ELEMENT_ID',
+    'ENDS_WITH',
+    'ENUM_VALUE_DESCRIPTOR_PROTO',
+    'ERROR',
+    'EUCLIDEAN_DISTANCE',
+    'EXP',
+    'EXTRACT',
+    'EXTRACT_FOR_DP_APPROX_COUNT_DISTINCT',
+    'FARM_FINGERPRINT',
+    'FILTER_FIELDS',
+    'FIRST_VALUE',
+    'FLATTEN',
+    'FLOAT32',
+    'FLOAT32_ARRAY',
+    'FLOAT64',
+    'FLOAT64_ARRAY',
+    'FLOOR',
+    'FORMAT',
+    'FORMAT_DATE',
+    'FORMAT_DATETIME',
+    'FORMAT_TIME',
+    'FORMAT_TIMESTAMP',
+    'FROM_BASE32',
+    'FROM_BASE64',
+    'FROM_HEX',
+    'GENERATE_ARRAY',
+    'GENERATE_DATE_ARRAY',
+    'GENERATE_RANGE_ARRAY',
+    'GENERATE_TIMESTAMP_ARRAY',
+    'GENERATE_UUID',
+    'GREATEST',
+    'GROUPING',
+    'HLL_COUNT.EXTRACT',
+    'HLL_COUNT.INIT',
+    'HLL_COUNT.MERGE',
+    'HLL_COUNT.MERGE_PARTIAL',
+    'IEEE_DIVIDE',
+    'IF',
+    'IFERROR',
+    'IFNULL',
+    'IN UNNEST',
+    'INITCAP',
+    'INIT_FOR_DP_APPROX_COUNT_DISTINCT',
+    'INSTR',
+    'INT64',
+    'INT64_ARRAY',
+    'IS DESTINATION OF',
+    'IS DISTINCT FROM',
+    'IS NOT DISTINCT FROM',
+    'IS SOURCE OF',
+    'ISERROR',
+    'IS_ACYCLIC',
+    'IS_INF',
+    'IS_NAN',
+    'IS_SIMPLE',
+    'IS_TRAIL',
+    'JSON_ARRAY',
+    'JSON_ARRAY_APPEND',
+    'JSON_ARRAY_INSERT',
+    'JSON_CONTAINS',
+    'JSON_EXTRACT',
+    'JSON_EXTRACT_ARRAY',
+    'JSON_EXTRACT_SCALAR',
+    'JSON_EXTRACT_STRING_ARRAY',
+    'JSON_KEYS',
+    'JSON_OBJECT',
+    'JSON_QUERY',
+    'JSON_QUERY_ARRAY',
+    'JSON_REMOVE',
+    'JSON_SET',
+    'JSON_STRIP_NULLS',
+    'JSON_TYPE',
+    'JSON_VALUE',
+    'JSON_VALUE_ARRAY',
+    'JUSTIFY_DAYS',
+    'JUSTIFY_HOURS',
+    'JUSTIFY_INTERVAL',
+    'KEYS.ADD_KEY_FROM_RAW_BYTES',
+    'KEYS.KEYSET_CHAIN',
+    'KEYS.KEYSET_FROM_JSON',
+    'KEYS.KEYSET_LENGTH',
+    'KEYS.KEYSET_TO_JSON',
+    'KEYS.NEW_KEYSET',
+    'KEYS.NEW_WRAPPED_KEYSET',
+    'KEYS.REWRAP_KEYSET',
+    'KEYS.ROTATE_KEYSET',
+    'KEYS.ROTATE_WRAPPED_KEYSET',
+    'KLL_QUANTILES.EXTRACT_FLOAT64',
+    'KLL_QUANTILES.EXTRACT_INT64',
+    'KLL_QUANTILES.EXTRACT_POINT_FLOAT64',
+    'KLL_QUANTILES.EXTRACT_POINT_INT64',
+    'KLL_QUANTILES.INIT_FLOAT64',
+    'KLL_QUANTILES.INIT_INT64',
+    'KLL_QUANTILES.MERGE_FLOAT64',
+    'KLL_QUANTILES.MERGE_INT64',
+    'KLL_QUANTILES.MERGE_PARTIAL',
+    'KLL_QUANTILES.MERGE_POINT_FLOAT64',
+    'KLL_QUANTILES.MERGE_POINT_INT64',
+    'L1_NORM',
+    'L2_NORM',
+    'LABELS',
+    'LAG',
+    'LAST_DAY',
+    'LAST_VALUE',
+    'LAX_BOOL',
+    'LAX_BOOL_ARRAY',
+    'LAX_FLOAT32',
+    'LAX_FLOAT32_ARRAY',
+    'LAX_FLOAT64',
+    'LAX_FLOAT64_ARRAY',
+    'LAX_INT64',
+    'LAX_INT64_ARRAY',
+    'LAX_STRING',
+    'LAX_STRING_ARRAY',
+    'LEAD',
+    'LEAST',
+    'LEFT',
+    'LENGTH',
+    'LIKE ALL',
+    'LIKE ALL UNNEST',
+    'LIKE ANY',
+    'LIKE ANY UNNEST',
+    'LN',
+    'LOG',
+    'LOG10',
+    'LOGICAL_AND',
+    'LOGICAL_OR',
+    'LOWER',
+    'LPAD',
+    'LTRIM',
+    'MAKE_INTERVAL',
+    'MANHATTAN_DISTANCE',
+    'MAP_CARDINALITY',
+    'MAP_CONTAINS_KEY',
+    'MAP_DELETE',
+    'MAP_EMPTY',
+    'MAP_ENTRIES_SORTED',
+    'MAP_ENTRIES_UNSORTED',
+    'MAP_FILTER',
+    'MAP_FROM_ARRAY',
+    'MAP_GET',
+    'MAP_INSERT',
+    'MAP_INSERT_OR_REPLACE',
+    'MAP_KEYS_SORTED',
+    'MAP_KEYS_UNSORTED',
+    'MAP_REPLACE',
+    'MAP_VALUES_SORTED',
+    'MAP_VALUES_SORTED_BY_KEY',
+    'MAP_VALUES_UNSORTED',
+    'MAX',
+    'MD5',
+    'MERGE_PARTIAL_FOR_DP_APPROX_COUNT_DISTINCT',
+    'MIN',
+    'MOD',
+    'NET.HOST',
+    'NET.IPV4_FROM_INT64',
+    'NET.IPV4_TO_INT64',
+    'NET.IP_FROM_STRING',
+    'NET.IP_NET_MASK',
+    'NET.IP_TO_STRING',
+    'NET.IP_TRUNC',
+    'NET.PUBLIC_SUFFIX',
+    'NET.REG_DOMAIN',
+    'NET.SAFE_IP_FROM_STRING',
+    'NEW_UUID',
+    'NODES',
+    'NORMALIZE',
+    'NORMALIZE_AND_CASEFOLD',
+    'NOT LIKE ALL',
+    'NOT LIKE ALL UNNEST',
+    'NOT LIKE ANY',
+    'NOT LIKE ANY UNNEST',
+    'NTH_VALUE',
+    'NTILE',
+    'NULLIF',
+    'NULLIFERROR',
+    'NULLIFZERO',
+    'OCTET_LENGTH',
+    'OFFSET',
+    'ORDINAL',
+    'PARSE_BIGNUMERIC',
+    'PARSE_DATE',
+    'PARSE_DATETIME',
+    'PARSE_JSON',
+    'PARSE_NUMERIC',
+    'PARSE_TIME',
+    'PARSE_TIMESTAMP',
+    'PATH',
+    'PATH_FIRST',
+    'PATH_LAST',
+    'PATH_LENGTH',
+    'PERCENTILE_CONT',
+    'PERCENTILE_DISC',
+    'PERCENT_RANK',
+    'PI',
+    'PIVOT',
+    'PI_BIGNUMERIC',
+    'PI_NUMERIC',
+    'POW',
+    'POWER',
+    'PROPERTY_EXISTS',
+    'PROPERTY_NAMES',
+    'PROTO_MAP_CONTAINS_KEY',
+    'PROTO_MODIFY_MAP',
+    'RAND',
+    'RANGE',
+    'RANGE_BUCKET',
+    'RANGE_CONTAINS',
+    'RANGE_END',
+    'RANGE_INTERSECT',
+    'RANGE_IS_END_UNBOUNDED',
+    'RANGE_IS_START_UNBOUNDED',
+    'RANGE_OVERLAPS',
+    'RANGE_START',
+    'RANK',
+    'REGEXP_CONTAINS',
+    'REGEXP_EXTRACT',
+    'REGEXP_EXTRACT_ALL',
+    'REGEXP_INSTR',
+    'REGEXP_REPLACE',
+    'REGEXP_SUBSTR',
+    'REPEAT',
+    'REPLACE',
+    'REVERSE',
+    'RIGHT',
+    'ROUND',
+    'ROW_NUMBER',
+    'RPAD',
+    'RTRIM',
+    'S2_CELLIDFROMPOINT',
+    'S2_COVERINGCELLIDS',
+    'SAFE_ADD',
+    'SAFE_CONVERT_BYTES_TO_STRING',
+    'SAFE_DIVIDE',
+    'SAFE_MULTIPLY',
+    'SAFE_NEGATE',
+    'SAFE_OFFSET',
+    'SAFE_ORDINAL',
+    'SAFE_SUBTRACT',
+    'SAFE_TO_JSON',
+    'SAME',
+    'SEC',
+    'SECH',
+    'SESSION_USER',
+    'SHA1',
+    'SHA256',
+    'SHA512',
+    'SIGN',
+    'SIN',
+    'SINH',
+    'SOUNDEX',
+    'SOURCE_NODE_ID',
+    'SPLIT',
+    'SPLIT_SUBSTR',
+    'SQRT',
+    'STARTS_WITH',
+    'STDDEV',
+    'STDDEV_POP',
+    'STDDEV_SAMP',
+    'STRING',
+    'STRING_AGG',
+    'STRING_ARRAY',
+    'STRPOS',
+    'ST_ANGLE',
+    'ST_AREA',
+    'ST_ASBINARY',
+    'ST_ASGEOJSON',
+    'ST_ASKML',
+    'ST_ASTEXT',
+    'ST_AZIMUTH',
+    'ST_BOUNDARY',
+    'ST_BOUNDINGBOX',
+    'ST_BUFFER',
+    'ST_BUFFERWITHTOLERANCE',
+    'ST_CENTROID',
+    'ST_CENTROID_AGG',
+    'ST_CLOSESTPOINT',
+    'ST_CLUSTERDBSCAN',
+    'ST_CONTAINS',
+    'ST_CONVEXHULL',
+    'ST_COVEREDBY',
+    'ST_COVERS',
+    'ST_DIFFERENCE',
+    'ST_DIMENSION',
+    'ST_DISJOINT',
+    'ST_DISTANCE',
+    'ST_DUMP',
+    'ST_DUMPPOINTS',
+    'ST_DWITHIN',
+    'ST_ENDPOINT',
+    'ST_EQUALS',
+    'ST_EXTENT',
+    'ST_EXTERIORRING',
+    'ST_GEOGFROM',
+    'ST_GEOGFROMGEOJSON',
+    'ST_GEOGFROMKML',
+    'ST_GEOGFROMTEXT',
+    'ST_GEOGFROMWKB',
+    'ST_GEOGPOINT',
+    'ST_GEOGPOINTFROMGEOHASH',
+    'ST_GEOHASH',
+    'ST_GEOMETRYTYPE',
+    'ST_HAUSDORFFDISTANCE',
+    'ST_HAUSDORFFDWITHIN',
+    'ST_INTERIORRINGS',
+    'ST_INTERSECTION',
+    'ST_INTERSECTS',
+    'ST_INTERSECTSBOX',
+    'ST_ISCLOSED',
+    'ST_ISCOLLECTION',
+    'ST_ISEMPTY',
+    'ST_ISRING',
+    'ST_LENGTH',
+    'ST_LINEINTERPOLATEPOINT',
+    'ST_LINELOCATEPOINT',
+    'ST_LINESUBSTRING',
+    'ST_MAKELINE',
+    'ST_MAKEPOLYGON',
+    'ST_MAKEPOLYGONORIENTED',
+    'ST_MAXDISTANCE',
+    'ST_NEAREST_NEIGHBORS',
+    'ST_NPOINTS',
+    'ST_NUMGEOMETRIES',
+    'ST_NUMPOINTS',
+    'ST_PERIMETER',
+    'ST_POINTN',
+    'ST_SIMPLIFY',
+    'ST_SNAPTOGRID',
+    'ST_STARTPOINT',
+    'ST_TOUCHES',
+    'ST_UNARYUNION',
+    'ST_UNION',
+    'ST_UNION_AGG',
+    'ST_WITHIN',
+    'ST_X',
+    'ST_Y',
+    'SUBSTR',
+    'SUBSTRING',
+    'SUM',
+    'TAN',
+    'TANH',
+    'TIME',
+    'TIMESTAMP',
+    'TIMESTAMP_ADD',
+    'TIMESTAMP_BUCKET',
+    'TIMESTAMP_DIFF',
+    'TIMESTAMP_FROM_UNIX_MICROS',
+    'TIMESTAMP_FROM_UNIX_MILLIS',
+    'TIMESTAMP_FROM_UNIX_SECONDS',
+    'TIMESTAMP_MICROS',
+    'TIMESTAMP_MILLIS',
+    'TIMESTAMP_SECONDS',
+    'TIMESTAMP_SUB',
+    'TIMESTAMP_TRUNC',
+    'TIME_ADD',
+    'TIME_DIFF',
+    'TIME_SUB',
+    'TIME_TRUNC',
+    'TO_BASE32',
+    'TO_BASE64',
+    'TO_CODE_POINTS',
+    'TO_HEX',
+    'TO_JSON',
+    'TO_JSON_STRING',
+    'TRANSLATE',
+    'TRIM',
+    'TRUNC',
+    'TYPEOF',
+    'UNICODE',
+    'UNIX_DATE',
+    'UNIX_MICROS',
+    'UNIX_MILLIS',
+    'UNIX_SECONDS',
+    'UNNEST',
+    'UNPIVOT',
+    'UPPER',
+    'VARIANCE',
+    'VAR_POP',
+    'VAR_SAMP',
+    'ZEROIFNULL',
+]
+
+keywords = [
+    'ABORT',
+    'ACCESS',
+    'ACTION',
+    'ACYCLIC',
+    'ADD',
+    'AFTER',
+    'AGGREGATE',
+    'ALL',
+    'ALTER',
+    'ALWAYS',
+    'ANALYZE',
+    'AND',
+    'ANY',
+    'APPROX',
+    'ARE',
+    'AS',
+    'ASC',
+    'ASCENDING',
+    'ASSERT',
+    'ASSERT_ROWS_MODIFIED',
+    'AT',
+    'BATCH',
+    'BEGIN',
+    'BETWEEN',
+    'BIGDECIMAL',
+    'BREAK',
+    'BY',
+    'CALL',
+    'CASCADE',
+    'CASE',
+    'CAST',
+    'CHECK',
+    'CLAMPED',
+    'CLONE',
+    'CLUSTER',
+    'COLLATE',
+    'COLUMN',
+    'COLUMNS',
+    'COMMIT',
+    'CONFLICT',
+    'CONNECTION',
+    'CONSTANT',
+    'CONSTRAINT',
+    'CONTAINS',
+    'CONTINUE',
+    'COPY',
+    'CORRESPONDING',
+    'CREATE',
+    'CROSS',
+    'CUBE',
+    'CURRENT',
+    'CYCLE',
+    'DATA',
+    'DATABASE',
+    'DAY',
+    'DAYOFWEEK',
+    'DAYOFYEAR',
+    'DECIMAL',
+    'DECLARE',
+    'DEFAULT',
+    'DEFINE',
+    'DEFINER',
+    'DELETE',
+    'DELETION',
+    'DEPTH',
+    'DESC',
+    'DESCENDING',
+    'DESCRIBE',
+    'DESCRIPTOR',
+    'DESTINATION',
+    'DETERMINISTIC',
+    'DISTINCT',
+    'DO',
+    'DROP',
+    'EDGE',
+    'ELSE',
+    'ELSEIF',
+    'END',
+    'ENFORCED',
+    'ERROR',
+    'ESCAPE',
+    'EXCEPT',
+    'EXCEPTION',
+    'EXCLUDE',
+    'EXECUTE',
+    'EXISTS',
+    'EXPLAIN',
+    'EXPORT',
+    'EXTEND',
+    'EXTERNAL',
+    'EXTRACT',
+    'FALSE',
+    'FETCH',
+    'FIELD',
+    'FILES',
+    'FILL',
+    'FILTER',
+    'FIRST',
+    'FOLLOWING',
+    'FOR',
+    'FOREIGN',
+    'FORK',
+    'FORMAT',
+    'FRIDAY',
+    'FROM',
+    'FULL',
+    'FUNCTION',
+    'GENERATED',
+    'GRANT',
+    'GRAPH',
+    'GRAPH_TABLE',
+    'GROUP',
+    'GROUPING',
+    'GROUPS',
+    'GROUP_ROWS',
+    'HAS',
+    'HASH',
+    'HAVING',
+    'HIDDEN',
+    'HOUR',
+    'IDENTITY',
+    'IF',
+    'IGNORE',
+    'IMMEDIATE',
+    'IMMUTABLE',
+    'IMPORT',
+    'IN',
+    'INCLUDE',
+    'INCREMENT',
+    'INDEX',
+    'INNER',
+    'INOUT',
+    'INPUT',
+    'INSERT',
+    'INTERLEAVE',
+    'INTERSECT',
+    'INTO',
+    'INVOKER',
+    'IS',
+    'ISOLATION',
+    'ISOWEEK ',
+    'ISOYEAR',
+    'ITERATE',
+    'JOIN',
+    'KEY',
+    'LABEL',
+    'LABELED',
+    'LANGUAGE',
+    'LAST',
+    'LATERAL',
+    'LEAVE',
+    'LEFT',
+    'LET',
+    'LEVEL',
+    'LIKE',
+    'LIMIT',
+    'LOAD',
+    'LOG',
+    'LOOKUP',
+    'LOOP',
+    'MACRO',
+    'MATCH',
+    'MATCHED',
+    'MATCH_RECOGNIZE',
+    'MATERIALIZED',
+    'MAX',
+    'MAXVALUE',
+    'MEASURES',
+    'MERGE',
+    'MESSAGE',
+    'METADATA',
+    'MICROSECOND',
+    'MILLISECOND',
+    'MIN',
+    'MINUTE',
+    'MINVALUE',
+    'MODEL',
+    'MODULE',
+    'MONDAY',
+    'MONTH',
+    'NAME',
+    'NANOSECOND',
+    'NATURAL',
+    'NEW',
+    'NEXT',
+    'NO',
+    'NODE',
+    'NOT',
+    'NOTHING',
+    'NULL',
+    'NULLS',
+    'NULL_FILTERED',
+    'OF',
+    'OFFSET',
+    'ON',
+    'ONEOF_CASE',
+    'ONLY',
+    'OPTIONAL',
+    'OPTIONS',
+    'OR',
+    'ORDER',
+    'OUT',
+    'OUTER',
+    'OUTPUT',
+    'OVER',
+    'OVERWRITE',
+    'PARENT',
+    'PARTITION',
+    'PARTITIONS',
+    'PAST',
+    'PATH',
+    'PATHS',
+    'PATTERN',
+    'PERCENT',
+    'PIVOT',
+    'POLICIES',
+    'POLICY',
+    'PRECEDING',
+    'PRIMARY',
+    'PRIVATE',
+    'PRIVILEGE',
+    'PRIVILEGES',
+    'PROCEDURE',
+    'PROJECT',
+    'PROPERTIES',
+    'PROPERTY',
+    'PUBLIC',
+    'QUALIFY',
+    'QUARTER',
+    'RAISE',
+    'RAW',
+    'READ',
+    'RECURSIVE',
+    'REFERENCES',
+    'REMOTE',
+    'REMOVE',
+    'RENAME',
+    'REPEAT',
+    'REPEATABLE',
+    'REPLACE',
+    'REPLACE_FIELDS',
+    'REPLICA',
+    'REPORT',
+    'RESPECT',
+    'RESTRICT',
+    'RESTRICTION',
+    'RETURN',
+    'RETURNS',
+    'REVOKE',
+    'RIGHT',
+    'ROLLBACK',
+    'ROLLUP',
+    'ROW',
+    'ROWS',
+    'RUN',
+    'SAFE_CAST',
+    'SATURDAY',
+    'SCHEMA',
+    'SEARCH',
+    'SECOND ',
+    'SECURITY',
+    'SELECT',
+    'SEQUENCE',
+    'SET',
+    'SETS',
+    'SHORTEST',
+    'SHOW',
+    'SIMPLE',
+    'SKIP',
+    'SNAPSHOT',
+    'SOME',
+    'SOURCE',
+    'SQL',
+    'STABLE',
+    'START',
+    'STATIC_DESCRIBE',
+    'STORED',
+    'STORING',
+    'STRICT',
+    'SUNDAY',
+    'SYSTEM',
+    'SYSTEM_TIME',
+    'TABLE',
+    'TABLES',
+    'TABLESAMPLE',
+    'TARGET',
+    'TEMP',
+    'TEMPORARY',
+    'THEN',
+    'THURSDAY',
+    'TO',
+    'TRAIL',
+    'TRANSACTION',
+    'TRANSFORM',
+    'TREAT',
+    'TRUE',
+    'TRUNCATE',
+    'TUESDAY',
+    'TYPE',
+    'UNBOUNDED',
+    'UNDROP',
+    'UNION',
+    'UNIQUE',
+    'UNKNOWN',
+    'UNNEST',
+    'UNPIVOT',
+    'UNTIL',
+    'UPDATE',
+    'USING',
+    'VALUE',
+    'VALUES',
+    'VECTOR',
+    'VIEW',
+    'VIEWS',
+    'VOLATILE',
+    'WALK',
+    'WEDNESDAY',
+    'WEEK',
+    'WEIGHT',
+    'WHEN',
+    'WHERE',
+    'WHILE',
+    'WINDOW',
+    'WITH',
+    'WITHIN',
+    'WRITE',
+    'YEAR',
+    'ZONE',
+]
+
+operators = [
+    '!=',
+    '&',
+    '*',
+    '+',
+    '-',
+    '/',
+    '<',
+    '<<',
+    '<=',
+    '=',
+    '>',
+    '>=',
+    '>>',
+    '^',
+    '|',
+    '||',
+    '~',
+]
+
+types = [
+    'ARRAY',
+    'BIGNUMERIC',
+    'BOOL',
+    'BYTES',
+    'DATE',
+    'DATETIME',
+    'DOUBLE',
+    'ENUM',
+    'EXTENDED',
+    'FLOAT',
+    'GEOGRAPHY',
+    'GRAPH_ELEMENT',
+    'GRAPH_PATH',
+    'INT32',
+    'INT64',
+    'INTERVAL',
+    'JSON',
+    'MAP',
+    'MEASURE',
+    'NUMERIC',
+    'PROTO',
+    'RANGE',
+    'STRING',
+    'STRUCT',
+    'TIME',
+    'TIMESTAMP',
+    'TIMESTAMP_PICOS',
+    'TOKENLIST',
+    'UINT32',
+    'UINT64',
+    'UUID',
+]
diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py
index 69a1cb18..24971b1c 100644
--- a/pygments/lexers/_mapping.py
+++ b/pygments/lexers/_mapping.py
@@ -195,6 +195,7 @@ LEXERS = {
     'GoLexer': ('pygments.lexers.go', 'Go', ('go', 'golang'), ('*.go',), ('text/x-gosrc',)),
     'GoloLexer': ('pygments.lexers.jvm', 'Golo', ('golo',), ('*.golo',), ()),
     'GoodDataCLLexer': ('pygments.lexers.business', 'GoodData-CL', ('gooddata-cl',), ('*.gdc',), ('text/x-gooddata-cl',)),
+    'GoogleSqlLexer': ('pygments.lexers.sql', 'GoogleSQL', ('googlesql', 'zetasql'), ('*.googlesql', '*.googlesql.sql'), ('text/x-google-sql', 'text/x-google-sql-aux')),
     'GosuLexer': ('pygments.lexers.jvm', 'Gosu', ('gosu',), ('*.gs', '*.gsx', '*.gsp', '*.vark'), ('text/x-gosu',)),
     'GosuTemplateLexer': ('pygments.lexers.jvm', 'Gosu Template', ('gst',), ('*.gst',), ('text/x-gosu-template',)),
     'GraphQLLexer': ('pygments.lexers.graphql', 'GraphQL', ('graphql',), ('*.graphql',), ()),
diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py
index 90165389..56a926d3 100644
--- a/pygments/lexers/sql.py
+++ b/pygments/lexers/sql.py
@@ -40,6 +40,7 @@
     :license: BSD, see LICENSE for details.
 """
 
+import collections
 import re
 
 from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, words
@@ -56,12 +57,13 @@ from pygments.lexers._mysql_builtins import \
     MYSQL_KEYWORDS, \
     MYSQL_OPTIMIZER_HINTS
 
+from pygments.lexers import _googlesql_builtins
 from pygments.lexers import _tsql_builtins
 
 
-__all__ = ['PostgresLexer', 'PlPgsqlLexer', 'PostgresConsoleLexer',
-           'PostgresExplainLexer', 'SqlLexer', 'TransactSqlLexer',
-           'MySqlLexer', 'SqliteConsoleLexer', 'RqlLexer']
+__all__ = ['GoogleSqlLexer', 'PostgresLexer', 'PlPgsqlLexer',
+           'PostgresConsoleLexer', 'PostgresExplainLexer', 'SqlLexer',
+           'TransactSqlLexer', 'MySqlLexer', 'SqliteConsoleLexer', 'RqlLexer']
 
 line_re  = re.compile('.*?\n')
 sqlite_prompt_re = re.compile(r'^(?:sqlite|   ...)>(?= )')
@@ -77,6 +79,12 @@ tsql_go_re = re.compile(r'\bgo\b', re.IGNORECASE)
 tsql_declare_re = re.compile(r'\bdeclare\s+@', re.IGNORECASE)
 tsql_variable_re = re.compile(r'@[a-zA-Z_]\w*\b')
 
+# Identifiers for analyse_text()
+googlesql_identifiers = (
+    _googlesql_builtins.functionnames
+    + _googlesql_builtins.keywords
+    + _googlesql_builtins.types)
+
 
 def language_callback(lexer, match):
     """Parse the content of a $-string using a lexer
@@ -964,6 +972,166 @@ class MySqlLexer(RegexLexer):
         return rating
 
 
+class GoogleSqlLexer(RegexLexer):
+    """
+    GoogleSQL is Google's standard SQL dialect, formerly known as ZetaSQL.
+
+    The list of keywords includes reserved words for future use.
+    """
+
+    name = 'GoogleSQL'
+    aliases = ['googlesql', 'zetasql']
+    filenames = ['*.googlesql', '*.googlesql.sql']
+    mimetypes = ['text/x-google-sql', 'text/x-google-sql-aux']
+    url = 'https://cloud.google.com/bigquery/googlesql'
+    version_added = '2.19'
+
+    flags = re.IGNORECASE
+    tokens = {
+        'root': [
+            (r'\s+', Whitespace),
+
+            # Comments
+            (r'(?:#|--\s+).*', Comment.Single),
+            (r'/\*', Comment.Multiline, 'multiline-comment'),
+
+            # Hexadecimal literals
+            (r"x'([0-9a-f]{2})+'", Number.Hex),
+            (r'0x[0-9a-f]+', Number.Hex),
+
+            # Binary literals
+            (r"b'[01]+'", Number.Bin),
+            (r'0b[01]+', Number.Bin),
+
+            # Numeric literals
+            (r'[0-9]+\.[0-9]*(e[+-]?[0-9]+)?', Number.Float),  # Mandatory integer, optional fraction and exponent
+            (r'[0-9]*\.[0-9]+(e[+-]?[0-9]+)?', Number.Float),  # Mandatory fraction, optional integer and exponent
+            (r'[0-9]+e[+-]?[0-9]+', Number.Float),  # Exponents with integer significands are still floats
+            (r'[0-9]+(?=[^0-9a-z$_\u0080-\uffff])', Number.Integer),  # Integers that are not in a schema object name
+
+            # Date literals
+            (r"\{\s*d\s*(?P<quote>['\"])\s*\d{2}(\d{2})?.?\d{2}.?\d{2}\s*(?P=quote)\s*\}",
+             Literal.Date),
+
+            # Time literals
+            (r"\{\s*t\s*(?P<quote>['\"])\s*(?:\d+\s+)?\d{1,2}.?\d{1,2}.?\d{1,2}(\.\d*)?\s*(?P=quote)\s*\}",
+             Literal.Date),
+
+            # Timestamp literals
+            (
+                r"\{\s*ts\s*(?P<quote>['\"])\s*"
+                r"\d{2}(?:\d{2})?.?\d{2}.?\d{2}"  # Date part
+                r"\s+"  # Whitespace between date and time
+                r"\d{1,2}.?\d{1,2}.?\d{1,2}(\.\d*)?"  # Time part
+                r"\s*(?P=quote)\s*\}",
+                Literal.Date
+            ),
+
+            # String literals
+            (r"'", String.Single, 'single-quoted-string'),
+            (r'"', String.Double, 'double-quoted-string'),
+
+            # Variables
+            (r'@@(?:global\.|persist\.|persist_only\.|session\.)?[a-z_]+', Name.Variable),
+            (r'@[a-z0-9_$.]+', Name.Variable),
+            (r"@'", Name.Variable, 'single-quoted-variable'),
+            (r'@"', Name.Variable, 'double-quoted-variable'),
+            (r"@`", Name.Variable, 'backtick-quoted-variable'),
+            (r'\?', Name.Variable),  # For demonstrating prepared statements
+
+            # Exceptions; these words tokenize differently in different contexts.
+            (r'\b(set)(?!\s*\()', Keyword),
+            (r'\b(character)(\s+)(set)\b', bygroups(Keyword, Whitespace, Keyword)),
+
+            # Constants, types, keywords, functions, operators
+            (words(_googlesql_builtins.constants, prefix=r'\b', suffix=r'\b'), Name.Constant),
+            (words(_googlesql_builtins.types, prefix=r'\b', suffix=r'\b'), Keyword.Type),
+            (words(_googlesql_builtins.keywords, prefix=r'\b', suffix=r'\b'), Keyword),
+            (words(_googlesql_builtins.functionnames, prefix=r'\b', suffix=r'\b(\s*)(\()'),
+             bygroups(Name.Function, Whitespace, Punctuation)),
+            (words(_googlesql_builtins.operators, prefix=r'\b', suffix=r'\b'), Operator),
+
+            # Schema object names
+            #
+            # Note: Although the first regex supports unquoted all-numeric
+            # identifiers, this will not be a problem in practice because
+            # numeric literals have already been handled above.
+            #
+            ('[0-9a-z$_\u0080-\uffff]+', Name),
+            (r'`', Name.Quoted, 'schema-object-name'),
+
+            # Punctuation
+            (r'[(),.;]', Punctuation),
+        ],
+
+        # Multiline comment substates
+        # ---------------------------
+
+        'multiline-comment': [
+            (r'[^*]+', Comment.Multiline),
+            (r'\*/', Comment.Multiline, '#pop'),
+            (r'\*', Comment.Multiline),
+        ],
+
+        # String substates
+        # ----------------
+
+        'single-quoted-string': [
+            (r"[^'\\]+", String.Single),
+            (r"''", String.Escape),
+            (r"""\\[0'"bnrtZ\\%_]""", String.Escape),
+            (r"'", String.Single, '#pop'),
+        ],
+
+        'double-quoted-string': [
+            (r'[^"\\]+', String.Double),
+            (r'""', String.Escape),
+            (r"""\\[0'"bnrtZ\\%_]""", String.Escape),
+            (r'"', String.Double, '#pop'),
+        ],
+
+        # Variable substates
+        # ------------------
+
+        'single-quoted-variable': [
+            (r"[^']+", Name.Variable),
+            (r"''", Name.Variable),
+            (r"'", Name.Variable, '#pop'),
+        ],
+
+        'double-quoted-variable': [
+            (r'[^"]+', Name.Variable),
+            (r'""', Name.Variable),
+            (r'"', Name.Variable, '#pop'),
+        ],
+
+        'backtick-quoted-variable': [
+            (r'[^`]+', Name.Variable),
+            (r'``', Name.Variable),
+            (r'`', Name.Variable, '#pop'),
+        ],
+
+        # Schema object name substates
+        # ----------------------------
+        #
+        # "Name.Quoted" and "Name.Quoted.Escape" are non-standard but
+        # formatters will style them as "Name" by default but add
+        # additional styles based on the token name. This gives users
+        # flexibility to add custom styles as desired.
+        #
+        'schema-object-name': [
+            (r'[^`]+', Name.Quoted),
+            (r'``', Name.Quoted.Escape),
+            (r'`', Name.Quoted, '#pop'),
+        ],
+    }
+
+    def analyse_text(text):
+        tokens = collections.Counter(text.split())
+        return 0.001 * sum(count for t, count in tokens.items()
+                           if t in googlesql_identifiers)
+
+
 class SqliteConsoleLexer(Lexer):
     """
     Lexer for example sessions using sqlite3.


Test patch:
diff --git a/tests/snippets/googlesql/googlesql_test.txt b/tests/snippets/googlesql/googlesql_test.txt
new file mode 100644
index 00000000..b69a64c3
--- /dev/null
+++ b/tests/snippets/googlesql/googlesql_test.txt
@@ -0,0 +1,1485 @@
+---input---
+BEGIN TRANSACTION
+CREATE TEMP TABLE Flights(total INT64)  AS SELECT * FROM UNNEST([10,23,3,14,55]) AS a;
+SELECT *, SPLIT_SUBSTR('blah', 3||4) FROM Flights;
+
+## function calls and builtins
+
+SELECT abs(1.5);
+CREATE OR REPLACE my_table
+SELECT REPLACE('good show', 'good', 'great');
+SELECT LPAD("hello", 10);
+SELECT D3A_COUNT.TO_HLL();
+SELECT KLL_QUANTILES.MERGE_UINT64();
+SELECT MyNonBuiltinFunction(an_arg);
+SELECT MyNonBuiltinFunction((SELECT 1), an_arg), Baz();
+SELECT MyNonBuiltinFunction(')'), Baz(an_arg);
+SELECT (1)
+DEFINE TABLE Foo (options);
+DEFINE MACRO FOO the body of the macro with first arg $1 and second arg $2;
+SELECT $mymacro FROM my_table;
+SELECT "A macro inside a string: $mymacro" FROM my_table;
+SELECT 'A macro inside a string: $mymacro' FROM my_table;
+SELECT """A macro inside a string: $mymacro""" FROM my_table;
+SELECT rb"""A macro inside a string: $mymacro("arg1", "arg2")""" FROM my_table;
+select creation, latency from my_table_${YYYYMMDD+1};
+select creation, latency from my_table_${YYYY+2};
+select creation, latency from my_table_${YYYYMMDD-3};
+select creation, latency from my_table_${DD};
+select "This is the day of the month ${DD}. QED.";
+select * from logs limit ${LimitCount};
+SELECT 1 = 1, 1 != 42;
+SELECT 1 > 2;
+LOAD my.script;
+
+## Ambiguous keywords, either type or function or keywords.
+
+SELECT JSON '{"name": "Alice", "age": 30}';
+SELECT IF("%.1f", 1/3);
+CREATE TABLE IF NOT EXISTS my_table [(my_column int64)];
+SELECT EXTRACT(DAY FROM DATE '2013-12-25');
+SELECT CAST(1 AS BOOL);
+SELECT element from UNNEST([1, 2, 3] as element);
+select [1, 2, 3][OFFSET(0)];
+SELECT * FROM UNNEST(['a', 'b']) AS letter
+ORDER BY letter ASC LIMIT 1 OFFSET 1;
+SELECT * FROM Produce PIVOT(SUM(sales) FOR quarter IN ('Q1', 'Q2', 'Q3', 'Q4'))
+SELECT * FROM Produce UNPIVOT(sales FOR quarter IN (Q1, Q2, Q3, Q4))
+
+## comments
+
+SELECT TRUE;  -- double-dash comment
+SELECT TRUE;  # hash comment
+SELECT TRUE;  // this is a comment
+SELECT /* this is block comment */ TRUE;
+# Bracket comments in stock SQL VS Code config are not supported in GoogleSQL
+SELECT %{bracket comment};
+
+## embedding JS
+
+CREATE FUNCTION f(x INT, y INT)
+RETURNS DOUBLE LANGUAGE js AS """return (x*y);""";
+
+## embedding Lua
+
+CREATE FUNCTION f(x INT, y INT)
+RETURNS DOUBLE LANGUAGE lua AS """return (x*y);""";
+
+### strings
+
+SELECT 'Hi !';
+SELECT "Hi !";
+SELECT 'a tab \t in a single-quoted string';
+SELECT "a tab \t in a single-quoted string";
+SELECT "string with a # sign";
+SELECT 'string with a # sign';
+SELECT 'a string with a \' single quote';
+SELECT "a string with a \" double quote";
+SELECT """triple double quote""";
+SELECT '''triple single quote''';
+SELECT 'triple single quote no word boundary';
+SELECT "triple single quote no word boundary";
+SELECT '''triple single quote no word boundary''';
+SELECT b'binary single quoted string';
+SELECT B'binary single quoted string';
+SELECT b"binary double quoted string";
+SELECT B"binary double quoted string";
+SELECT b'''triple single quote''';
+SELECT B'''triple single quote''';
+SELECT b"""triple double quote""";
+SELECT B"""triple double quote""";
+SELECT r"raw single quoted string";
+SELECT r"double quote";
+SELECT rb"double quote";
+SELECT rB"double quote";
+SELECT R"double quote";
+SELECT Rb"double quote";
+SELECT RB"double quote";
+SELECT r'single quote';
+SELECT rb'single quote';
+SELECT rB'single quote';
+SELECT R'single quote';
+SELECT Rb'single quote';
+SELECT RB'single quote';
+SELECT r'single quote with an uninterpreted \' escape';
+SELECT b'single quote with an *interpreted* \' escape';
+SELECT r"""raw single quoted string""";
+SELECT r'''triple single quote''';
+SELECT rb'''triple single quote''';
+SELECT rB'''triple single quote''';
+SELECT R'''triple single quote''';
+SELECT Rb'''triple single quote''';
+SELECT RB'''triple single quote''';
+SELECT r"""triple double quote""";
+SELECT rb"""triple double quote""";
+SELECT rB"""triple double quote""";
+SELECT R"""triple double quote""";
+SELECT Rb"""triple double quote""";
+SELECT RB"""triple double quote""";
+SELECT RBr"""triple double quote""";
+SELECT RBb"""triple double quote""";
+SELECT rr"invalid raw single quoted string";
+SELECT rr"""invalid raw single quoted string""";
+SELECT rr'invalid raw single quoted string';
+
+---tokens---
+'BEGIN'       Keyword
+' '           Text.Whitespace
+'TRANSACTION' Keyword
+'\n'          Text.Whitespace
+
+'CREATE'      Keyword
+' '           Text.Whitespace
+'TEMP'        Keyword
+' '           Text.Whitespace
+'TABLE'       Keyword
+' '           Text.Whitespace
+'Flights'     Name
+'('           Punctuation
+'total'       Name
+' '           Text.Whitespace
+'INT64'       Keyword.Type
+')'           Punctuation
+'  '          Text.Whitespace
+'AS'          Keyword
+' '           Text.Whitespace
+'SELECT'      Keyword
+' '           Text.Whitespace
+'*'           Error
+' '           Text.Whitespace
+'FROM'        Keyword
+' '           Text.Whitespace
+'UNNEST'      Keyword
+'('           Punctuation
+'['           Error
+'10'          Literal.Number.Integer
+','           Punctuation
+'23'          Literal.Number.Integer
+','           Punctuation
+'3'           Literal.Number.Integer
+','           Punctuation
+'14'          Literal.Number.Integer
+','           Punctuation
+'55'          Literal.Number.Integer
+']'           Error
+')'           Punctuation
+' '           Text.Whitespace
+'AS'          Keyword
+' '           Text.Whitespace
+'a'           Name
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'*'           Error
+','           Punctuation
+' '           Text.Whitespace
+'SPLIT_SUBSTR' Name.Function
+'('           Punctuation
+"'"           Literal.String.Single
+'blah'        Literal.String.Single
+"'"           Literal.String.Single
+','           Punctuation
+' '           Text.Whitespace
+'3'           Literal.Number.Integer
+'||'          Operator
+'4'           Literal.Number.Integer
+')'           Punctuation
+' '           Text.Whitespace
+'FROM'        Keyword
+' '           Text.Whitespace
+'Flights'     Name
+';'           Punctuation
+'\n\n'        Text.Whitespace
+
+'## function calls and builtins' Comment.Single
+'\n\n'        Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'abs'         Name.Function
+'('           Punctuation
+'1.5'         Literal.Number.Float
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'CREATE'      Keyword
+' '           Text.Whitespace
+'OR'          Keyword
+' '           Text.Whitespace
+'REPLACE'     Keyword
+' '           Text.Whitespace
+'my_table'    Name
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'REPLACE'     Keyword
+'('           Punctuation
+"'"           Literal.String.Single
+'good show'   Literal.String.Single
+"'"           Literal.String.Single
+','           Punctuation
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'good'        Literal.String.Single
+"'"           Literal.String.Single
+','           Punctuation
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'great'       Literal.String.Single
+"'"           Literal.String.Single
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'LPAD'        Name.Function
+'('           Punctuation
+'"'           Literal.String.Double
+'hello'       Literal.String.Double
+'"'           Literal.String.Double
+','           Punctuation
+' '           Text.Whitespace
+'10'          Literal.Number.Integer
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'D3A_COUNT.TO_HLL' Name.Function
+'('           Punctuation
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'KLL_QUANTILES' Name
+'.'           Punctuation
+'MERGE_UINT64' Name
+'('           Punctuation
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'MyNonBuiltinFunction' Name
+'('           Punctuation
+'an_arg'      Name
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'MyNonBuiltinFunction' Name
+'('           Punctuation
+'('           Punctuation
+'SELECT'      Keyword
+' '           Text.Whitespace
+'1'           Literal.Number.Integer
+')'           Punctuation
+','           Punctuation
+' '           Text.Whitespace
+'an_arg'      Name
+')'           Punctuation
+','           Punctuation
+' '           Text.Whitespace
+'Baz'         Name
+'('           Punctuation
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'MyNonBuiltinFunction' Name
+'('           Punctuation
+"'"           Literal.String.Single
+')'           Literal.String.Single
+"'"           Literal.String.Single
+')'           Punctuation
+','           Punctuation
+' '           Text.Whitespace
+'Baz'         Name
+'('           Punctuation
+'an_arg'      Name
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'('           Punctuation
+'1'           Literal.Number.Integer
+')'           Punctuation
+'\n'          Text.Whitespace
+
+'DEFINE'      Keyword
+' '           Text.Whitespace
+'TABLE'       Keyword
+' '           Text.Whitespace
+'Foo'         Name
+' '           Text.Whitespace
+'('           Punctuation
+'options'     Keyword
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'DEFINE'      Keyword
+' '           Text.Whitespace
+'MACRO'       Keyword
+' '           Text.Whitespace
+'FOO'         Name
+' '           Text.Whitespace
+'the'         Name
+' '           Text.Whitespace
+'body'        Name
+' '           Text.Whitespace
+'of'          Keyword
+' '           Text.Whitespace
+'the'         Name
+' '           Text.Whitespace
+'macro'       Keyword
+' '           Text.Whitespace
+'with'        Keyword
+' '           Text.Whitespace
+'first'       Keyword
+' '           Text.Whitespace
+'arg'         Name
+' '           Text.Whitespace
+'$1'          Name
+' '           Text.Whitespace
+'and'         Keyword
+' '           Text.Whitespace
+'second '     Keyword
+'arg'         Name
+' '           Text.Whitespace
+'$2'          Name
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'$mymacro'    Name
+' '           Text.Whitespace
+'FROM'        Keyword
+' '           Text.Whitespace
+'my_table'    Name
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'"'           Literal.String.Double
+'A macro inside a string: $mymacro' Literal.String.Double
+'"'           Literal.String.Double
+' '           Text.Whitespace
+'FROM'        Keyword
+' '           Text.Whitespace
+'my_table'    Name
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'A macro inside a string: $mymacro' Literal.String.Single
+"'"           Literal.String.Single
+' '           Text.Whitespace
+'FROM'        Keyword
+' '           Text.Whitespace
+'my_table'    Name
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'A macro inside a string: $mymacro' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+' '           Text.Whitespace
+'FROM'        Keyword
+' '           Text.Whitespace
+'my_table'    Name
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rb'          Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'A macro inside a string: $mymacro(' Literal.String.Double
+'"'           Literal.String.Double
+'arg1'        Name
+'"'           Literal.String.Double
+', '          Literal.String.Double
+'"'           Literal.String.Double
+'arg2'        Name
+'"'           Literal.String.Double
+')'           Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+' '           Text.Whitespace
+'FROM'        Keyword
+' '           Text.Whitespace
+'my_table'    Name
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'select'      Keyword
+' '           Text.Whitespace
+'creation'    Name
+','           Punctuation
+' '           Text.Whitespace
+'latency'     Name
+' '           Text.Whitespace
+'from'        Keyword
+' '           Text.Whitespace
+'my_table_$'  Name
+'{'           Error
+'YYYYMMDD'    Name
+'+'           Operator
+'1'           Literal.Number.Integer
+'}'           Error
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'select'      Keyword
+' '           Text.Whitespace
+'creation'    Name
+','           Punctuation
+' '           Text.Whitespace
+'latency'     Name
+' '           Text.Whitespace
+'from'        Keyword
+' '           Text.Whitespace
+'my_table_$'  Name
+'{'           Error
+'YYYY'        Name
+'+'           Operator
+'2'           Literal.Number.Integer
+'}'           Error
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'select'      Keyword
+' '           Text.Whitespace
+'creation'    Name
+','           Punctuation
+' '           Text.Whitespace
+'latency'     Name
+' '           Text.Whitespace
+'from'        Keyword
+' '           Text.Whitespace
+'my_table_$'  Name
+'{'           Error
+'YYYYMMDD'    Name
+'-'           Operator
+'3'           Literal.Number.Integer
+'}'           Error
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'select'      Keyword
+' '           Text.Whitespace
+'creation'    Name
+','           Punctuation
+' '           Text.Whitespace
+'latency'     Name
+' '           Text.Whitespace
+'from'        Keyword
+' '           Text.Whitespace
+'my_table_$'  Name
+'{'           Error
+'DD'          Name
+'}'           Error
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'select'      Keyword
+' '           Text.Whitespace
+'"'           Literal.String.Double
+'This is the day of the month ${DD}. QED.' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'select'      Keyword
+' '           Text.Whitespace
+'*'           Error
+' '           Text.Whitespace
+'from'        Keyword
+' '           Text.Whitespace
+'logs'        Name
+' '           Text.Whitespace
+'limit'       Keyword
+' '           Text.Whitespace
+'$'           Name
+'{'           Error
+'LimitCount'  Name
+'}'           Error
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'1'           Literal.Number.Integer
+' '           Text.Whitespace
+'='           Error
+' '           Text.Whitespace
+'1'           Literal.Number.Integer
+','           Punctuation
+' '           Text.Whitespace
+'1'           Literal.Number.Integer
+' '           Text.Whitespace
+'!'           Error
+'='           Error
+' '           Text.Whitespace
+'42'          Literal.Number.Integer
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'1'           Literal.Number.Integer
+' '           Text.Whitespace
+'>'           Error
+' '           Text.Whitespace
+'2'           Literal.Number.Integer
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'LOAD'        Keyword
+' '           Text.Whitespace
+'my'          Name
+'.'           Punctuation
+'script'      Name
+';'           Punctuation
+'\n\n'        Text.Whitespace
+
+'## Ambiguous keywords, either type or function or keywords.' Comment.Single
+'\n\n'        Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'JSON'        Keyword.Type
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'{"name": "Alice", "age": 30}' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'IF'          Keyword
+'('           Punctuation
+'"'           Literal.String.Double
+'%.1f'        Literal.String.Double
+'"'           Literal.String.Double
+','           Punctuation
+' '           Text.Whitespace
+'1'           Literal.Number.Integer
+'/'           Operator
+'3'           Literal.Number.Integer
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'CREATE'      Keyword
+' '           Text.Whitespace
+'TABLE'       Keyword
+' '           Text.Whitespace
+'IF'          Keyword
+' '           Text.Whitespace
+'NOT'         Keyword
+' '           Text.Whitespace
+'EXISTS'      Keyword
+' '           Text.Whitespace
+'my_table'    Name
+' '           Text.Whitespace
+'['           Error
+'('           Punctuation
+'my_column'   Name
+' '           Text.Whitespace
+'int64'       Keyword.Type
+')'           Punctuation
+']'           Error
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'EXTRACT'     Keyword
+'('           Punctuation
+'DAY'         Keyword
+' '           Text.Whitespace
+'FROM'        Keyword
+' '           Text.Whitespace
+'DATE'        Keyword.Type
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'2013-12-25'  Literal.String.Single
+"'"           Literal.String.Single
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'CAST'        Keyword
+'('           Punctuation
+'1'           Literal.Number.Integer
+' '           Text.Whitespace
+'AS'          Keyword
+' '           Text.Whitespace
+'BOOL'        Keyword.Type
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'element'     Name
+' '           Text.Whitespace
+'from'        Keyword
+' '           Text.Whitespace
+'UNNEST'      Keyword
+'('           Punctuation
+'['           Error
+'1'           Literal.Number.Integer
+','           Punctuation
+' '           Text.Whitespace
+'2'           Literal.Number.Integer
+','           Punctuation
+' '           Text.Whitespace
+'3'           Literal.Number.Integer
+']'           Error
+' '           Text.Whitespace
+'as'          Keyword
+' '           Text.Whitespace
+'element'     Name
+')'           Punctuation
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'select'      Keyword
+' '           Text.Whitespace
+'['           Error
+'1'           Literal.Number.Integer
+','           Punctuation
+' '           Text.Whitespace
+'2'           Literal.Number.Integer
+','           Punctuation
+' '           Text.Whitespace
+'3'           Literal.Number.Integer
+']'           Error
+'['           Error
+'OFFSET'      Keyword
+'('           Punctuation
+'0'           Literal.Number.Integer
+')'           Punctuation
+']'           Error
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'*'           Error
+' '           Text.Whitespace
+'FROM'        Keyword
+' '           Text.Whitespace
+'UNNEST'      Keyword
+'('           Punctuation
+'['           Error
+"'"           Literal.String.Single
+'a'           Literal.String.Single
+"'"           Literal.String.Single
+','           Punctuation
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'b'           Literal.String.Single
+"'"           Literal.String.Single
+']'           Error
+')'           Punctuation
+' '           Text.Whitespace
+'AS'          Keyword
+' '           Text.Whitespace
+'letter'      Name
+'\n'          Text.Whitespace
+
+'ORDER'       Keyword
+' '           Text.Whitespace
+'BY'          Keyword
+' '           Text.Whitespace
+'letter'      Name
+' '           Text.Whitespace
+'ASC'         Keyword
+' '           Text.Whitespace
+'LIMIT'       Keyword
+' '           Text.Whitespace
+'1'           Literal.Number.Integer
+' '           Text.Whitespace
+'OFFSET'      Keyword
+' '           Text.Whitespace
+'1'           Literal.Number.Integer
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'*'           Error
+' '           Text.Whitespace
+'FROM'        Keyword
+' '           Text.Whitespace
+'Produce'     Name
+' '           Text.Whitespace
+'PIVOT'       Keyword
+'('           Punctuation
+'SUM'         Name.Function
+'('           Punctuation
+'sales'       Name
+')'           Punctuation
+' '           Text.Whitespace
+'FOR'         Keyword
+' '           Text.Whitespace
+'quarter'     Keyword
+' '           Text.Whitespace
+'IN'          Keyword
+' '           Text.Whitespace
+'('           Punctuation
+"'"           Literal.String.Single
+'Q1'          Literal.String.Single
+"'"           Literal.String.Single
+','           Punctuation
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'Q2'          Literal.String.Single
+"'"           Literal.String.Single
+','           Punctuation
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'Q3'          Literal.String.Single
+"'"           Literal.String.Single
+','           Punctuation
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'Q4'          Literal.String.Single
+"'"           Literal.String.Single
+')'           Punctuation
+')'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'*'           Error
+' '           Text.Whitespace
+'FROM'        Keyword
+' '           Text.Whitespace
+'Produce'     Name
+' '           Text.Whitespace
+'UNPIVOT'     Keyword
+'('           Punctuation
+'sales'       Name
+' '           Text.Whitespace
+'FOR'         Keyword
+' '           Text.Whitespace
+'quarter'     Keyword
+' '           Text.Whitespace
+'IN'          Keyword
+' '           Text.Whitespace
+'('           Punctuation
+'Q1'          Name
+','           Punctuation
+' '           Text.Whitespace
+'Q2'          Name
+','           Punctuation
+' '           Text.Whitespace
+'Q3'          Name
+','           Punctuation
+' '           Text.Whitespace
+'Q4'          Name
+')'           Punctuation
+')'           Punctuation
+'\n\n'        Text.Whitespace
+
+'## comments' Comment.Single
+'\n\n'        Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'TRUE'        Name.Constant
+';'           Punctuation
+'  '          Text.Whitespace
+'-- double-dash comment' Comment.Single
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'TRUE'        Name.Constant
+';'           Punctuation
+'  '          Text.Whitespace
+'# hash comment' Comment.Single
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'TRUE'        Name.Constant
+';'           Punctuation
+'  '          Text.Whitespace
+'/'           Error
+'/'           Error
+' '           Text.Whitespace
+'this'        Name
+' '           Text.Whitespace
+'is'          Keyword
+' '           Text.Whitespace
+'a'           Name
+' '           Text.Whitespace
+'comment'     Name
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'/*'          Comment.Multiline
+' this is block comment ' Comment.Multiline
+'*/'          Comment.Multiline
+' '           Text.Whitespace
+'TRUE'        Name.Constant
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'# Bracket comments in stock SQL VS Code config are not supported in GoogleSQL' Comment.Single
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'%'           Error
+'{'           Error
+'bracket'     Name
+' '           Text.Whitespace
+'comment'     Name
+'}'           Error
+';'           Punctuation
+'\n\n'        Text.Whitespace
+
+'## embedding JS' Comment.Single
+'\n\n'        Text.Whitespace
+
+'CREATE'      Keyword
+' '           Text.Whitespace
+'FUNCTION'    Keyword
+' '           Text.Whitespace
+'f'           Name
+'('           Punctuation
+'x'           Name
+' '           Text.Whitespace
+'INT'         Name
+','           Punctuation
+' '           Text.Whitespace
+'y'           Name
+' '           Text.Whitespace
+'INT'         Name
+')'           Punctuation
+'\n'          Text.Whitespace
+
+'RETURNS'     Keyword
+' '           Text.Whitespace
+'DOUBLE'      Keyword.Type
+' '           Text.Whitespace
+'LANGUAGE'    Keyword
+' '           Text.Whitespace
+'js'          Name
+' '           Text.Whitespace
+'AS'          Keyword
+' '           Text.Whitespace
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'return (x*y);' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n\n'        Text.Whitespace
+
+'## embedding Lua' Comment.Single
+'\n\n'        Text.Whitespace
+
+'CREATE'      Keyword
+' '           Text.Whitespace
+'FUNCTION'    Keyword
+' '           Text.Whitespace
+'f'           Name
+'('           Punctuation
+'x'           Name
+' '           Text.Whitespace
+'INT'         Name
+','           Punctuation
+' '           Text.Whitespace
+'y'           Name
+' '           Text.Whitespace
+'INT'         Name
+')'           Punctuation
+'\n'          Text.Whitespace
+
+'RETURNS'     Keyword
+' '           Text.Whitespace
+'DOUBLE'      Keyword.Type
+' '           Text.Whitespace
+'LANGUAGE'    Keyword
+' '           Text.Whitespace
+'lua'         Name
+' '           Text.Whitespace
+'AS'          Keyword
+' '           Text.Whitespace
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'return (x*y);' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n\n'        Text.Whitespace
+
+'### strings' Comment.Single
+'\n\n'        Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'Hi !'        Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'"'           Literal.String.Double
+'Hi !'        Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'a tab '      Literal.String.Single
+'\\t'         Literal.String.Escape
+' in a single-quoted string' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'"'           Literal.String.Double
+'a tab '      Literal.String.Double
+'\\t'         Literal.String.Escape
+' in a single-quoted string' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'"'           Literal.String.Double
+'string with a # sign' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'string with a # sign' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'a string with a ' Literal.String.Single
+"\\'"         Literal.String.Escape
+' single quote' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'"'           Literal.String.Double
+'a string with a ' Literal.String.Double
+'\\"'         Literal.String.Escape
+' double quote' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'triple double quote' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+"'"           Literal.String.Single
+"''"          Literal.String.Escape
+'triple single quote' Literal.String.Single
+"''"          Literal.String.Escape
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+"'"           Literal.String.Single
+'triple single quote no word boundary' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'"'           Literal.String.Double
+'triple single quote no word boundary' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+"'"           Literal.String.Single
+"''"          Literal.String.Escape
+'triple single quote no word boundary' Literal.String.Single
+"''"          Literal.String.Escape
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'b'           Name
+"'"           Literal.String.Single
+'binary single quoted string' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'B'           Name
+"'"           Literal.String.Single
+'binary single quoted string' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'b'           Name
+'"'           Literal.String.Double
+'binary double quoted string' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'B'           Name
+'"'           Literal.String.Double
+'binary double quoted string' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'b'           Name
+"'"           Literal.String.Single
+"''"          Literal.String.Escape
+'triple single quote' Literal.String.Single
+"''"          Literal.String.Escape
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'B'           Name
+"'"           Literal.String.Single
+"''"          Literal.String.Escape
+'triple single quote' Literal.String.Single
+"''"          Literal.String.Escape
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'b'           Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'triple double quote' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'B'           Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'triple double quote' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'r'           Name
+'"'           Literal.String.Double
+'raw single quoted string' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'r'           Name
+'"'           Literal.String.Double
+'double quote' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rb'          Name
+'"'           Literal.String.Double
+'double quote' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rB'          Name
+'"'           Literal.String.Double
+'double quote' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'R'           Name
+'"'           Literal.String.Double
+'double quote' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'Rb'          Name
+'"'           Literal.String.Double
+'double quote' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'RB'          Name
+'"'           Literal.String.Double
+'double quote' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'r'           Name
+"'"           Literal.String.Single
+'single quote' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rb'          Name
+"'"           Literal.String.Single
+'single quote' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rB'          Name
+"'"           Literal.String.Single
+'single quote' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'R'           Name
+"'"           Literal.String.Single
+'single quote' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'Rb'          Name
+"'"           Literal.String.Single
+'single quote' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'RB'          Name
+"'"           Literal.String.Single
+'single quote' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'r'           Name
+"'"           Literal.String.Single
+'single quote with an uninterpreted ' Literal.String.Single
+"\\'"         Literal.String.Escape
+' escape'     Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'b'           Name
+"'"           Literal.String.Single
+'single quote with an *interpreted* ' Literal.String.Single
+"\\'"         Literal.String.Escape
+' escape'     Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'r'           Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'raw single quoted string' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'r'           Name
+"'"           Literal.String.Single
+"''"          Literal.String.Escape
+'triple single quote' Literal.String.Single
+"''"          Literal.String.Escape
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rb'          Name
+"'"           Literal.String.Single
+"''"          Literal.String.Escape
+'triple single quote' Literal.String.Single
+"''"          Literal.String.Escape
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rB'          Name
+"'"           Literal.String.Single
+"''"          Literal.String.Escape
+'triple single quote' Literal.String.Single
+"''"          Literal.String.Escape
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'R'           Name
+"'"           Literal.String.Single
+"''"          Literal.String.Escape
+'triple single quote' Literal.String.Single
+"''"          Literal.String.Escape
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'Rb'          Name
+"'"           Literal.String.Single
+"''"          Literal.String.Escape
+'triple single quote' Literal.String.Single
+"''"          Literal.String.Escape
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'RB'          Name
+"'"           Literal.String.Single
+"''"          Literal.String.Escape
+'triple single quote' Literal.String.Single
+"''"          Literal.String.Escape
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'r'           Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'triple double quote' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rb'          Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'triple double quote' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rB'          Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'triple double quote' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'R'           Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'triple double quote' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'Rb'          Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'triple double quote' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'RB'          Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'triple double quote' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'RBr'         Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'triple double quote' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'RBb'         Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'triple double quote' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rr'          Name
+'"'           Literal.String.Double
+'invalid raw single quoted string' Literal.String.Double
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rr'          Name
+'"'           Literal.String.Double
+'""'          Literal.String.Escape
+'invalid raw single quoted string' Literal.String.Double
+'""'          Literal.String.Escape
+'"'           Literal.String.Double
+';'           Punctuation
+'\n'          Text.Whitespace
+
+'SELECT'      Keyword
+' '           Text.Whitespace
+'rr'          Name
+"'"           Literal.String.Single
+'invalid raw single quoted string' Literal.String.Single
+"'"           Literal.String.Single
+';'           Punctuation
+'\n'          Text.Whitespace
diff --git a/tests/test_terminal_formatter.py b/tests/test_terminal_formatter.py
index 20ae9a90..3489c852 100644
--- a/tests/test_terminal_formatter.py
+++ b/tests/test_terminal_formatter.py
@@ -61,6 +61,7 @@ class MyStyle(Style):
         Token.String:     'ansibrightblue bg:ansired',
         Token.Number:     'ansibrightgreen bg:ansigreen',
         Token.Number.Hex: 'ansigreen bg:ansibrightred',
+        Token.Other:      '#3366AA'
     }
 
 
@@ -76,7 +77,8 @@ async def function(a,b,c, *d, **kwarg:Bool)->Bool:
 
 def test_style_html():
     style = HtmlFormatter(style=MyStyle).get_style_defs()
-    assert '#555555' in style, "ansigray for comment not html css style"
+    assert '#555' in style, "ansigray for comment not html css style"
+    assert '36A' in style, "6-character style was not shortened"
 
 
 def test_others_work():