Debian Codegraph @

runtime/syntax/prql.yaml

raw
1 # https://prql-lang.org/
2 # https://github.com/PRQL/prql
3 filetype: prql
4
5 detect:
6 filename: "\\.prql$"
7
8 rules:
9 - statement: "\\b(let|module|into|case|type|func)\\b"
10
11 # Types
12 - type: "\\b(u?int(8|16|32|64)?|float(32|64)|bool|text|date|time|timestamp)\\b"
13 - type.keyword: "\\b(enum)\\b"
14 - constant.bool: "\\b(true|false|null|this|that)\\b"
15
16 # Built-in functions
17 - identifier: "\\b(abs|floor|ceil|pi|exp|ln|log10|log|sqrt|degrees|radians|cos|acos|sin|asin|tan|atan|pow|round)\\b" # Math module
18 - identifier: "\\b(min|max|sum|average|stddev|all|any|concat_array|count)\\b" # Aggregate functions
19 - identifier: "\\b(lag|lead|first|last|rank|rank_dense|row_number)\\b" # Window functions
20 - identifier: "\\b(tuple_every|tuple_map|tuple_zip|_eq|_is_null)\\b" # Tuple functions
21 - identifier: "\\b(as|in|from_text)\\b" # Misc
22 - identifier: "\\b(lower|upper|ltrim|rtrim|trim|length|extract|replace|starts_with|contains|ends_with)\\b" # Text module
23 - identifier: "\\b(to_text)\\b" # Date module
24 - identifier: "\\b(read_parquet|read_csv)\\b" # File-reading functions
25
26 # Modules
27 - identifier.class: "\\b(math|text|date|prql)\\b"
28
29 # Transforms
30 - statement: "\\b(aggregate|derive|filter|from|group|join|select|sort|take|window)\\b"
31
32 # Operators
33 - symbol.operator: "([~^.:;,+*|=!\\%@?]|<|>|/|-|&)"
34
35 # Brackets
36 - symbol.brackets: "[{}()\\[\\]]"
37
38 # Numbers
39 - constant.number: "\\b[0-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b" # decimal
40 - constant.number: "\\b0b(_?[01])+\\b" # bin
41 - constant.number: "\\b0o(_?[0-7])+\\b" # oct
42 - constant.number: "\\b0x(_?[0-9a-fA-F])+\\b" # hex
43 - constant: "\\b[0-9]+(years|months|weeks|days|hours|minutes|seconds|milliseconds|microseconds)\\b"
44
45 - constant.string:
46 start: "[frs]?\"\"\""
47 end: "\"\"\""
48 skip: "\\\\."
49 rules:
50 - constant.specialChar: "\\\\[bfnrt'\"\\\\]"
51 - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})"
52
53 - constant.string:
54 start: "[frs]?'''"
55 end: "'''"
56 skip: "\\\\."
57 rules:
58 - constant.specialChar: "\\\\[bfnrt'\"\\\\]"
59 - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})"
60
61 - constant.string:
62 start: "[frs]?\""
63 end: "\""
64 skip: "\\\\."
65 rules:
66 - constant.specialChar: "\\\\[bfnrt'\"\\\\]"
67 - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})"
68
69 - constant.string:
70 start: "[frs]?'"
71 end: "'"
72 skip: "\\\\."
73 rules:
74 - constant.specialChar: "\\\\[bfnrt'\"\\\\]"
75 - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u\\{[0-9A-Fa-f]{1,6}\\})"
76
77 - comment:
78 start: "#"
79 end: "$"
80 rules:
81 - todo: "(TODO|FIXME|NOTE):?"
82
83 # Decorators
84 - preproc: "@\\{([a-z]+(=[a-z0-9]+,?)?)*\\}"