Last active
January 3, 2018 07:51
-
-
Save metodribic/ec57a007a2ee6c5ca193d527c4836106 to your computer and use it in GitHub Desktop.
AQL syntax definition for sublime text 3
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 | |
--- | |
# See http://www.sublimetext.com/docs/3/syntax.html | |
file_extensions: | |
- aql | |
scope: source.aql | |
contexts: | |
# The prototype context is prepended to all contexts but those setting | |
# meta_include_prototype: false. | |
prototype: | |
- include: comments | |
main: | |
# The main context is the initial starting point of our syntax. | |
# Include other contexts from here (or specify them directly). | |
- include: keywords | |
- include: entity | |
- include: predicate | |
- include: numbers | |
- include: strings | |
- include: forward-slash | |
- include: sort | |
- include: support-function | |
- include: variables | |
keywords: | |
- match: '(?i:\b(select|from|where|contains|filter|group by|order by|tagged by|top|fetch|offset|limit|like|and|or|union all|as)\b)' | |
scope: keyword.control.aql | |
sort: | |
- match: (?i)\b(DESC|ASC)\b | |
scope: keyword.other.order.sql | |
entity: | |
- match: '(?i:\s(ehr|observation|composition|cluster|evaluation|instruction|action|versioned_object|version)\s)' | |
scope: entity.name.class.aql | |
predicate: | |
- match: '\[.*\]' | |
scope: keyword.operator.word.aql | |
operators: | |
- match: "=|>|<|!=" | |
scope: keyword.operator.comparison.sql | |
numbers: | |
- match: '\b(-)?[0-9]+\b' | |
scope: constant.numeric.aql | |
forward-slash: | |
- match: '\/' | |
scope: constant.character.escape.slash.aql | |
strings: | |
- match: "'" | |
captures: | |
0: punctuation.definition.string.begin.aql | |
push: | |
- meta_scope: string.quoted.single.aql | |
- match: "''" | |
scope: constant.character.escape.aql | |
- match: "'" | |
captures: | |
0: punctuation.definition.string.end.aql | |
pop: true | |
- match: '"' | |
captures: | |
0: punctuation.definition.string.begin.sql | |
push: | |
- meta_scope: string.quoted.double.sql | |
- match: '""' | |
scope: constant.character.escape.sql | |
- match: '"' | |
captures: | |
0: punctuation.definition.string.end.sql | |
pop: true | |
support-function: | |
- match: (?i)\b(AVG|COUNT|MIN|MAX|SUM)(?=\s*\() | |
scope: support.function.aggregate.aql | |
inside_string: | |
- meta_include_prototype: false | |
- meta_scope: string.quoted.double.aql | |
- match: '\.' | |
scope: constant.character.escape.aql | |
- match: '"' | |
scope: punctuation.definition.string.end.aql | |
pop: true | |
comments: | |
# Comments begin with a -- and finish at the end of the line. | |
- match: '--' | |
scope: punctuation.definition.comment.aql | |
push: | |
# This is an anonymous context push for brevity. | |
- meta_scope: comment.line.double-slash.aql | |
- match: $\n? | |
pop: true | |
dml: | |
- match: (?i:\b(select\s+(count)?(\()?(distinct|top))?\b) | |
scope: keyword.operator.word.aql | |
variables: | |
- match: '\:\w*' | |
scope: markup.bold.aql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment