Created
October 23, 2018 17:58
-
-
Save beckjake/5f23f848e38c0fc5343c54f8fbafe128 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%YAML 1.2 | |
--- | |
name: dbt SQL | |
file_extensions: | |
- sql | |
scope: source.dbt | |
contexts: | |
main: | |
# the default context is SQL | |
- match: "" | |
push: "Packages/SQL/SQL.sublime-syntax" | |
with_prototype: | |
- match: r"{%\s*(raw)\s*%}" | |
scope: keyword.control.dbt | |
push: rawblock | |
- match: "{#-?" | |
captures: | |
0: punctuation.definition.comment | |
push: | |
- meta_scope: comment.block.dbt | |
- match: "-?#}" | |
pop: true | |
- match: "{%-?" | |
push: expr | |
scope: entity.other.dbt.delimiter.tag | |
- match: "{{-?" | |
push: expr | |
scope: entity.other.dbt.delimiter.variable | |
rawblock: | |
- match: r"{%\s*(raw)\s*%}" | |
pop: true | |
expr: | |
- match: "-?}}" | |
pop: true | |
- match: "-?%}" | |
pop: true | |
# TODO: i was lazy here, the real jinja is much more descriptive. | |
- match: \b(macro|block|filter|is)\s+([a-zA-Z_][a-zA-Z0-9_]*)\b | |
captures: | |
1: keyword.control.dbt | |
2: variable.other.dbt.name | |
- match: \b(materialization)\s+([a-zA-Z_][a-zA-Z0-9_]*)\b | |
captures: | |
1: keyword.control.dbt | |
2: variable.other.dbt.name | |
- match: \b(call)\s+([a-zA-Z_][a-zA-Z0-9_]*)\b | |
captures: | |
1: keyword.control.dbt | |
2: variable.other.dbt.name | |
- match: \b(set|and|else|if|elif|in|import|not|or|recursive|with(out)?\s+context)\b | |
scope: keyword.control.dbt | |
- match: \b([Tt]rue|[Ff]alse|[Nn]one)\b | |
scope: constant.language.dbt | |
- match: \b(loop|super|self|varargs|kwargs)\b | |
scope: variable.language.dbt | |
- match: \bthis\b | |
scope: entity.name.struct | |
- match: \b((([a-zA-Z_][a-zA-Z0-9_]*)\.)*[a-zA-Z_][a-zA-Z0-9_]*)(?=\s*\()\b | |
captures: | |
1: entity.name.function | |
- match: "'" | |
push: | |
- meta_scope: string.quoted.single.dbt | |
- match: "'" | |
pop: true | |
- include: string_escape | |
- match: '"' | |
push: | |
- meta_scope: string.quoted.double.dbt | |
- match: '"' | |
pop: true | |
- include: string_escape | |
- match: '\[' | |
push: expr | |
string_escape: | |
- match: \\. | |
scope: constant.character.escape.dbt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment