rouge-ruby / rouge

A pure Ruby code highlighter that is compatible with Pygments
https://rouge.jneen.net/
Other
3.32k stars 731 forks source link

ksqlDB SQL #1804

Open doughogan opened 2 years ago

doughogan commented 2 years ago

Please note: New lexers are contributed to Rouge from the community. Your request will help the community in developing a lexer but it does not mean that anyone will develop the lexer.

I'd like to have ksqlDB SQL supported by Rouge. I work for Confluent and deliver training in ksqlDB, among other things, and develop training materials. We have the language for ksqlDB syntax highlighting set to sql but it doesn't have all of the keywords for ksqlDB.

ksqlDB SQL This is the ksqlDB syntax reference page: https://docs.ksqldb.io/en/latest/developer-guide/ksqldb-reference/quick-reference/

Implementation in other libraries If possible, include links to implementations in Pygments, Chroma, Highlight.js, etc.

Additional context I looked at the lever for sql - https://github.com/rouge-ruby/rouge/blob/master/lib/rouge/lexers/sql.rb - and suspect that this lever would be the same, just with the ksqlDB SQL keywords. I am not a Ruby developer though, so I don't want to submit a stab at code I don't have a means of testing. The list of standard sql keywords looks to be alphabetized. After I submit this issue, I will compile the ksqlDB SQL keywords list into an alphabetized list and add it here.

doughogan commented 2 years ago

Here's an alphabetical keyword list:

ADD ADVANCE ALL ALTER ANALYZE AND ARRAY AS ASSERT AT BETWEEN BY CASE CAST CHANGES COLUMN COLUMNS CREATE DATE DAY DAYS DECIMAL DELETE DESCRIBE DISTINCT DROP ELSE EMIT END ESCAPE EXISTS EXPLAIN EXTENDED FALSE FROM FULL FUNCTION FUNCTIONS GRACE GROUP HAVING HOPPING HOUR HOURS IF IN INNER INSERT INTEGER INTERVAL INTO IS JOIN KEY LEFT LIKE LIMIT LIST LOAD MAP MATERIALIZED MILLISECOND MILLISECONDS MINUTE MINUTES MONTH MONTHS NAMESPACE NOT NULL ON OR OUTER PARTITION PARTITIONS PERIOD PRIMARY PRINT QUERIES QUERY RENAME REPLACE RETENTION RIGHT SECOND SECONDS SELECT SHOW SINK SIZE SOURCE STREAM STREAMS STRUCT TABLE TABLES TERMINATE THEN TIME TIMESTAMP TO TOPIC TOPICS TRUE TUMBLING TYPE TYPES VALUES VARIABLES VIEW WHEN WHERE WINDOW WITH WITHIN YEAR YEARS ZONE