l0bsterssg

node.js static responsive blog post generator
Log | Files | Refs | README

sql.js (14921B)


      1 /*
      2  Language: SQL
      3  Contributors: Nikolay Lisienko <info@neor.ru>, Heiko August <post@auge8472.de>, Travis Odom <travis.a.odom@gmail.com>, Vadimtro <vadimtro@yahoo.com>, Benjamin Auder <benjamin.auder@gmail.com>
      4  Website: https://en.wikipedia.org/wiki/SQL
      5  Category: common
      6  */
      7 
      8 function sql(hljs) {
      9   var COMMENT_MODE = hljs.COMMENT('--', '$');
     10   return {
     11     name: 'SQL',
     12     case_insensitive: true,
     13     illegal: /[<>{}*]/,
     14     contains: [
     15       {
     16         beginKeywords:
     17           'begin end start commit rollback savepoint lock alter create drop rename call ' +
     18           'delete do handler insert load replace select truncate update set show pragma grant ' +
     19           'merge describe use explain help declare prepare execute deallocate release ' +
     20           'unlock purge reset change stop analyze cache flush optimize repair kill ' +
     21           'install uninstall checksum restore check backup revoke comment values with',
     22         end: /;/, endsWithParent: true,
     23         keywords: {
     24           $pattern: /[\w\.]+/,
     25           keyword:
     26             'as abort abs absolute acc acce accep accept access accessed accessible account acos action activate add ' +
     27             'addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias ' +
     28             'all allocate allow alter always analyze ancillary and anti any anydata anydataset anyschema anytype apply ' +
     29             'archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan ' +
     30             'atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid ' +
     31             'authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile ' +
     32             'before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float ' +
     33             'binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound ' +
     34             'bucket buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel ' +
     35             'capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base ' +
     36             'char_length character_length characters characterset charindex charset charsetform charsetid check ' +
     37             'checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close ' +
     38             'cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation ' +
     39             'collect colu colum column column_value columns columns_updated comment commit compact compatibility ' +
     40             'compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn ' +
     41             'connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection ' +
     42             'consider consistent constant constraint constraints constructor container content contents context ' +
     43             'contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost ' +
     44             'count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation ' +
     45             'critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user ' +
     46             'cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add ' +
     47             'date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts ' +
     48             'day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate ' +
     49             'declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults ' +
     50             'deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank ' +
     51             'depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor ' +
     52             'deterministic diagnostics difference dimension direct_load directory disable disable_all ' +
     53             'disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div ' +
     54             'do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable ' +
     55             'editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt ' +
     56             'end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors ' +
     57             'escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding ' +
     58             'execu execut execute exempt exists exit exp expire explain explode export export_set extended extent external ' +
     59             'external_1 external_2 externally extract failed failed_login_attempts failover failure far fast ' +
     60             'feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final ' +
     61             'finish first first_value fixed flash_cache flashback floor flush following follows for forall force foreign ' +
     62             'form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ' +
     63             'ftp full function general generated get get_format get_lock getdate getutcdate global global_name ' +
     64             'globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups ' +
     65             'gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex ' +
     66             'hierarchy high high_priority hosts hour hours http id ident_current ident_incr ident_seed identified ' +
     67             'identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment ' +
     68             'index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile ' +
     69             'initial initialized initially initrans inmemory inner innodb input insert install instance instantiable ' +
     70             'instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat ' +
     71             'is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists ' +
     72             'keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lateral lax lcase ' +
     73             'lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit ' +
     74             'lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate ' +
     75             'locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call ' +
     76             'logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime ' +
     77             'managed management manual map mapping mask master master_pos_wait match matched materialized max ' +
     78             'maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans ' +
     79             'md5 measures median medium member memcompress memory merge microsecond mid migration min minextents ' +
     80             'minimum mining minus minute minutes minvalue missing mod mode model modification modify module monitoring month ' +
     81             'months mount move movement multiset mutex name name_const names nan national native natural nav nchar ' +
     82             'nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile ' +
     83             'nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile ' +
     84             'nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder ' +
     85             'nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck ' +
     86             'noswitch not nothing notice notnull notrim novalidate now nowait nth_value nullif nulls num numb numbe ' +
     87             'nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ' +
     88             'ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old ' +
     89             'on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date ' +
     90             'oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary ' +
     91             'out outer outfile outline output over overflow overriding package pad parallel parallel_enable ' +
     92             'parameters parent parse partial partition partitions pascal passing password password_grace_time ' +
     93             'password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex ' +
     94             'pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc ' +
     95             'performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin ' +
     96             'policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction ' +
     97             'prediction_cost prediction_details prediction_probability prediction_set prepare present preserve ' +
     98             'prior priority private private_sga privileges procedural procedure procedure_analyze processlist ' +
     99             'profiles project prompt protection public publishingservername purge quarter query quick quiesce quota ' +
    100             'quotename radians raise rand range rank raw read reads readsize rebuild record records ' +
    101             'recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh ' +
    102             'regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy ' +
    103             'reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename ' +
    104             'repair repeat replace replicate replication required reset resetlogs resize resource respect restore ' +
    105             'restricted result result_cache resumable resume retention return returning returns reuse reverse revoke ' +
    106             'right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows ' +
    107             'rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll ' +
    108             'sdo_georaster sdo_topo_geometry search sec_to_time second seconds section securefile security seed segment select ' +
    109             'self semi sequence sequential serializable server servererror session session_user sessions_per_user set ' +
    110             'sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor ' +
    111             'si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin ' +
    112             'size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex ' +
    113             'source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows ' +
    114             'sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone ' +
    115             'standby start starting startup statement static statistics stats_binomial_test stats_crosstab ' +
    116             'stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep ' +
    117             'stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev ' +
    118             'stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate ' +
    119             'subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum ' +
    120             'suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate ' +
    121             'sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tablesample tan tdo ' +
    122             'template temporary terminated tertiary_weights test than then thread through tier ties time time_format ' +
    123             'time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr ' +
    124             'timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking ' +
    125             'transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate ' +
    126             'try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress ' +
    127             'under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unnest unpivot ' +
    128             'unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert ' +
    129             'url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date ' +
    130             'utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var ' +
    131             'var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray ' +
    132             'verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear ' +
    133             'wellformed when whene whenev wheneve whenever where while whitespace window with within without work wrapped ' +
    134             'xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces ' +
    135             'xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek',
    136           literal:
    137             'true false null unknown',
    138           built_in:
    139             'array bigint binary bit blob bool boolean char character date dec decimal float int int8 integer interval number ' +
    140             'numeric real record serial serial8 smallint text time timestamp tinyint varchar varchar2 varying void'
    141         },
    142         contains: [
    143           {
    144             className: 'string',
    145             begin: '\'', end: '\'',
    146             contains: [{begin: '\'\''}]
    147           },
    148           {
    149             className: 'string',
    150             begin: '"', end: '"',
    151             contains: [{begin: '""'}]
    152           },
    153           {
    154             className: 'string',
    155             begin: '`', end: '`'
    156           },
    157           hljs.C_NUMBER_MODE,
    158           hljs.C_BLOCK_COMMENT_MODE,
    159           COMMENT_MODE,
    160           hljs.HASH_COMMENT_MODE
    161         ]
    162       },
    163       hljs.C_BLOCK_COMMENT_MODE,
    164       COMMENT_MODE,
    165       hljs.HASH_COMMENT_MODE
    166     ]
    167   };
    168 }
    169 
    170 module.exports = sql;