From 2bd8bc8d8484a4a8852280f16888a819acbfde7a Mon Sep 17 00:00:00 2001 From: Matthias Q Date: Fri, 3 Mar 2023 20:12:37 +0100 Subject: feat(prql): add prql support (#6126) --- runtime/queries/prql/highlights.scm | 136 ++++++++++++++++++++++++++++++++++++ runtime/queries/prql/injections.scm | 8 +++ 2 files changed, 144 insertions(+) create mode 100644 runtime/queries/prql/highlights.scm create mode 100644 runtime/queries/prql/injections.scm (limited to 'runtime') diff --git a/runtime/queries/prql/highlights.scm b/runtime/queries/prql/highlights.scm new file mode 100644 index 00000000..5cfedee4 --- /dev/null +++ b/runtime/queries/prql/highlights.scm @@ -0,0 +1,136 @@ +[ + (keyword_from) + (keyword_filter) + (keyword_derive) + (keyword_group) + (keyword_aggregate) + (keyword_sort) + (keyword_take) + (keyword_window) + (keyword_join) + (keyword_select) + (keyword_switch) + (keyword_append) + (keyword_remove) + (keyword_intersect) + (keyword_rolling) + (keyword_rows) + (keyword_expanding) + (keyword_let) + (keyword_prql) + (keyword_from_text) +] @keyword + +(literal) @string + +(assignment + alias: (field) @variable.other.member) + +alias: (identifier) @variable.other.member + +(f_string) @string.special +(s_string) @string.special + +(comment) @comment + +(keyword_func) @keyword.function + +(function_call + (identifier) @function) + +[ + "+" + "-" + "*" + "/" + "=" + "==" + "<" + "<=" + "!=" + ">=" + ">" + "->" + (bang) +] @operator + +[ + "(" + ")" + "[" + "]" +] @punctuation.bracket + +[ + "," + "." + (pipe) +] @punctuation.delimiter + +(literal + (integer) @constant.numeric.integer) + +(integer) @constant.numeric.integer + +(literal + (decimal_number) @constant.numeric.float) + +(decimal_number) @constant.numeric.float + +[ + (keyword_min) + (keyword_max) + (keyword_count) + (keyword_count_distinct) + (keyword_average) + (keyword_avg) + (keyword_sum) + (keyword_stddev) + (keyword_count) +] @function + +[ + (keyword_side) + (keyword_version) + (keyword_target) + (keyword_null) + (keyword_format) +] @attribute + +(target) @function.builtin + + [ + (date) + (time) + (timestamp) +] @string.special + +[ + (keyword_left) + (keyword_inner) + (keyword_right) + (keyword_full) + (keyword_csv) + (keyword_json) +] @function.method + +[ + (keyword_true) + (keyword_false) +] @constant.builtin.boolean + +[ + (keyword_and) + (keyword_or) +] @keyword.operator + +(function_definition + (keyword_func) + name: (identifier) @function) + +(parameter + (identifier) @variable.parameter) + +(variable + (keyword_let) + name: (identifier) @constant) diff --git a/runtime/queries/prql/injections.scm b/runtime/queries/prql/injections.scm new file mode 100644 index 00000000..02a8919f --- /dev/null +++ b/runtime/queries/prql/injections.scm @@ -0,0 +1,8 @@ +((s_string) @injection.content + (#set! injection.language "sql")) + +(from_text + (keyword_from_text) + (keyword_json) + (literal) @injection.content + (#set! injection.language "json")) -- cgit v1.2.3-70-g09d2