A major mode for editing sqllogictest (.slt) files with syntax highlighting.
- Syntax highlighting for SQL keywords, functions, strings, numbers, and comments
- Query command highlighting for
query <types> [sort] [label]lines - Statement command highlighting for
statement ok|error|countlines - Conditional directives for
skipifandonlyif - Control records for
haltandhash-threshold - Result separator highlighting for
----lines - Comment support for lines starting with
# - Auto-detection of
.sltfiles
-
Copy
sqllogictest-mode.elto your Emacs load path (e.g.,~/.emacs.d/) -
Add to your Emacs configuration (
~/.emacsor~/.emacs.d/init.el):
(load "sqllogictest-mode")(use-package sqllogictest-mode
:load-path "path/to/sqllogictest-mode.el"
:mode "\\.slt\\'")The mode will automatically activate when opening .slt files. You can also manually activate it with:
M-x sqllogictest-mode
The mode provides highlighting for:
- Comments: Lines starting with
# - Query commands:
query TTTT,query ITT rowsort,query I nosort label1, etc. - Statement commands:
statement ok,statement error,statement count 5 - Conditional directives:
skipif postgresql,onlyif mysql - Control records:
halt,hash-threshold 100 - SQL keywords: SELECT, FROM, WHERE, ORDER BY, CREATE TABLE, INSERT INTO, etc.
- SQL functions: COUNT, SUM, ABS, CEIL, FLOOR, COALESCE, etc.
- Result separators:
----lines - String literals: Single and double quoted strings
- Numbers: Integer and decimal numbers
The project includes ERT tests for all font-lock rules. Run them with:
make testThis runs Emacs in batch mode and executes all tests defined in sqllogictest-mode-test.el.
# Test basic retail data access
# Select * from dim_persona
query TTTT
SELECT * FROM dim_persona ORDER BY persona_key
----
CUST001 John Smith
CUST002 Jane Johnson