Class: Rouge::Lexers::SQL

Inherits:
RegexLexer show all
Defined in:
lib/rouge/lexers/sql.rb

Direct Known Subclasses

HQL

Constant Summary

Constants inherited from RegexLexer

RegexLexer::MAX_NULL_SCANS

Constants included from Token::Tokens

Token::Tokens::Num, Token::Tokens::Str

Instance Attribute Summary

Attributes inherited from Rouge::Lexer

#options

Class Method Summary collapse

Methods inherited from RegexLexer

append, #delegate, #goto, #group, #groups, #in_state?, #pop!, prepend, #push, #recurse, replace_state, #reset!, #reset_stack, #stack, start, start_procs, state, #state, #state?, state_definitions, states, #step, #stream_tokens, #token

Methods inherited from Rouge::Lexer

aliases, all, #as_bool, #as_lexer, #as_list, #as_string, #as_token, #bool_option, continue_lex, #continue_lex, debug_enabled?, demo, demo_file, desc, detect?, detectable?, disable_debug!, enable_debug!, filenames, find, find_fancy, guess, guess_by_filename, guess_by_mimetype, guess_by_source, guesses, #hash_option, #initialize, lex, #lex, #lexer_option, #list_option, lookup_fancy, mimetypes, option, option_docs, #reset!, #stream_tokens, #string_option, tag, #tag, title, #token_option, #with

Methods included from Token::Tokens

token

Constructor Details

This class inherits a constructor from Rouge::Lexer

Class Method Details

.keywordsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/rouge/lexers/sql.rb', line 13

def self.keywords
  @keywords ||= Set.new %w(
    ABORT ABS ABSOLUTE ACCESS ADA ADD ADMIN AFTER AGGREGATE ALIAS
    ALL ALLOCATE ALTER ANALYSE ANALYZE AND ANY ARE AS ASC ASENSITIVE
    ASSERTION ASSIGNMENT ASYMMETRIC AT ATOMIC AUTHORIZATION
    AVG BACKWARD BEFORE BEGIN BETWEEN BITVAR BIT_LENGTH BOTH
    BREADTH BY C CACHE CALL CALLED CARDINALITY CASCADE CASCADED
    CASE CAST CATALOG CATALOG_NAME CHAIN CHARACTERISTICS
    CHARACTER_LENGTH CHARACTER_SET_CATALOG CHARACTER_SET_NAME
    CHARACTER_SET_SCHEMA CHAR_LENGTH CHECK CHECKED CHECKPOINT
    CLASS CLASS_ORIGIN CLOB CLOSE CLUSTER COALSECE COBOL COLLATE
    COLLATION COLLATION_CATALOG COLLATION_NAME COLLATION_SCHEMA
    COLUMN COLUMN_NAME COMMAND_FUNCTION COMMAND_FUNCTION_CODE
    COMMENT COMMIT COMMITTED COMPLETION CONDITION_NUMBER
    CONNECT CONNECTION CONNECTION_NAME CONSTRAINT CONSTRAINTS
    CONSTRAINT_CATALOG CONSTRAINT_NAME CONSTRAINT_SCHEMA
    CONSTRUCTOR CONTAINS CONTINUE CONVERSION CONVERT COPY
    CORRESPONTING COUNT CREATE CREATEDB CREATEUSER CROSS CUBE
    CURRENT CURRENT_DATE CURRENT_PATH CURRENT_ROLE CURRENT_TIME
    CURRENT_TIMESTAMP CURRENT_USER CURSOR CURSOR_NAME CYCLE DATA
    DATABASE DATETIME_INTERVAL_CODE DATETIME_INTERVAL_PRECISION
    DAY DEALLOCATE DECLARE DEFAULT DEFAULTS DEFERRABLE DEFERRED
    DEFINED DEFINER DELETE DELIMITER DELIMITERS DEREF DESC DESCRIBE
    DESCRIPTOR DESTROY DESTRUCTOR DETERMINISTIC DIAGNOSTICS
    DICTIONARY DISCONNECT DISPATCH DISTINCT DO DOMAIN DROP
    DYNAMIC DYNAMIC_FUNCTION DYNAMIC_FUNCTION_CODE EACH ELSE
    ENCODING ENCRYPTED END END-EXEC EQUALS ESCAPE EVERY EXCEPT
    ESCEPTION EXCLUDING EXCLUSIVE EXEC EXECUTE EXISTING EXISTS
    EXPLAIN EXTERNAL EXTRACT FALSE FETCH FINAL FIRST FOLLOWING FOR
    FORCE FOREIGN FORTRAN FORWARD FOUND FREE FREEZE FROM FULL FUNCTION
    G GENERAL GENERATED GET GLOBAL GO GOTO GRANT GRANTED GROUP
    GROUPING HANDLER HAVING HIERARCHY HOLD HOST IDENTITY IGNORE
    ILIKE IMMEDIATE IMMUTABLE IMPLEMENTATION IMPLICIT IN INCLUDING
    INCREMENT INDEX INDITCATOR INFIX INHERITS INITIALIZE INITIALLY
    INNER INOUT INPUT INSENSITIVE INSERT INSTANTIABLE INSTEAD
    INTERSECT INTO INVOKER IS ISNULL ISOLATION ITERATE JOIN KEY
    KEY_MEMBER KEY_TYPE LANCOMPILER LANGUAGE LARGE LAST LATERAL
    LEADING LEFT LENGTH LESS LEVEL LIKE LIMIT LISTEN LOAD LOCAL
    LOCALTIME LOCALTIMESTAMP LOCATION LOCATOR LOCK LOWER MAP MATCH
    MAX MAXVALUE MESSAGE_LENGTH MESSAGE_OCTET_LENGTH MESSAGE_TEXT
    METHOD MIN MINUTE MINVALUE MOD MODE MODIFIES MODIFY MONTH
    MORE MOVE MUMPS NAMES NATURAL NCLOB NEW NEXT
    NO NOCREATEDB NOCREATEUSER NONE NOT NOTHING NOTIFY NOTNULL
    NULL NULLABLE NULLIF OBJECT OCTET_LENGTH OF OFF OFFSET OIDS
    OLD ON ONLY OPEN OPERATION OPERATOR OPTION OPTIONS OR ORDER
    ORDINALITY OUT OUTER OUTPUT OVERLAPS OVERLAY OVERRIDING
    OWNER PAD PARAMETER PARAMETERS PARAMETER_MODE PARAMATER_NAME
    PARAMATER_ORDINAL_POSITION PARAMETER_SPECIFIC_CATALOG
    PARAMETER_SPECIFIC_NAME PARAMATER_SPECIFIC_SCHEMA PARTIAL PARTITION
    PASCAL PENDANT PLACING PLI POSITION POSTFIX PREFIX PRECEDING PREORDER
    PREPARE PRESERVE PRIMARY PRIOR PRIVILEGES PROCEDURAL PROCEDURE
    PUBLIC RANGE READ READS RECHECK RECURSIVE REF REFERENCES REFERENCING
    REINDEX RELATIVE RENAME REPEATABLE REPLACE RESET RESTART
    RESTRICT RESULT RETURN RETURNED_LENGTH RETURNED_OCTET_LENGTH
    RETURNED_SQLSTATE RETURNS REVOKE RIGHT ROLE ROLLBACK ROLLUP
    ROUTINE ROUTINE_CATALOG ROUTINE_NAME ROUTINE_SCHEMA ROW ROWS
    ROW_COUNT RULE SAVE_POINT SCALE SCHEMA SCHEMA_NAME SCOPE SCROLL
    SEARCH SECOND SECURITY SELECT SELF SENSITIVE SERIALIZABLE
    SERVER_NAME SESSION SESSION_USER SET SETOF SETS SHARE SHOW
    SIMILAR SIMPLE SIZE SOME SOURCE SPACE SPECIFIC SPECIFICTYPE
    SPECIFIC_NAME SQL SQLCODE SQLERROR SQLEXCEPTION SQLSTATE
    SQLWARNINIG STABLE START STATE STATEMENT STATIC STATISTICS
    STDIN STDOUT STORAGE STRICT STRUCTURE STYPE SUBCLASS_ORIGIN
    SUBLIST SUBSTRING SUM SYMMETRIC SYSID SYSTEM SYSTEM_USER
    TABLE TABLE_NAME  TEMP TEMPLATE TEMPORARY TERMINATE THAN THEN
    TIMEZONE_HOUR TIMEZONE_MINUTE TO TOAST TRAILING
    TRANSATION TRANSACTIONS_COMMITTED TRANSACTIONS_ROLLED_BACK
    TRANSATION_ACTIVE TRANSFORM TRANSFORMS TRANSLATE TRANSLATION
    TREAT TRIGGER TRIGGER_CATALOG TRIGGER_NAME TRIGGER_SCHEMA TRIM
    TRUE TRUNCATE TRUSTED TYPE UNCOMMITTED UNDER UNENCRYPTED UNION
    UNIQUE UNKNOWN UNLISTEN UNNAMED UNNEST UNTIL UPDATE UPPER
    USAGE USER USER_DEFINED_TYPE_CATALOG USER_DEFINED_TYPE_NAME
    USER_DEFINED_TYPE_SCHEMA USING VACUUM VALID VALIDATOR VALUES
    VARIABLE VERBOSE VERSION VIEW VOLATILE WHEN WHENEVER WHERE
    WINDOW WITH WITHOUT WORK WRITE ZONE
  )
end

.keywords_typeObject



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/rouge/lexers/sql.rb', line 91

def self.keywords_type
  # sources:
  # https://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
  # https://dev.mysql.com/doc/refman/5.7/en/date-and-time-type-overview.html
  # https://dev.mysql.com/doc/refman/5.7/en/string-type-overview.html
  @keywords_type ||= Set.new(%w(
      ZEROFILL UNSIGNED SIGNED SERIAL BIT TINYINT BOOL BOOLEAN SMALLINT
      MEDIUMINT INT INTEGER BIGINT DECIMAL DEC NUMERIC FIXED FLOAT DOUBLE
      PRECISION REAL
      DATE DATETIME TIMESTAMP TIME YEAR
      NATIONAL CHAR CHARACTER NCHAR BYTE
      VARCHAR VARYING BINARY VARBINARY TINYBLOB TINYTEXT BLOB TEXT
      MEDIUMBLOB MEDIUMTEXT LONGBLOB LONGTEXT ENUM
  ))
end