-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
thom
committed
Aug 11, 2017
1 parent
8864742
commit 9a82149
Showing
11 changed files
with
3,265 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# [PackageDev] target_format: plist, ext: tmPreferences | ||
name: Comments | ||
scope: source.sql | ||
settings: | ||
shellVariables: | ||
- name: TM_COMMENT_START | ||
value: '--' | ||
- name: TM_COMMENT_START_2 | ||
value: '/*' | ||
- name: TM_COMMENT_END_2 | ||
value: '*/' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>name</key> | ||
<string>Comments</string> | ||
<key>scope</key> | ||
<string>source.sql.oracle, source.plsql</string> | ||
<key>settings</key> | ||
<dict> | ||
<key>shellVariables</key> | ||
<array> | ||
<dict> | ||
<key>name</key> | ||
<string>TM_COMMENT_START</string> | ||
<key>value</key> | ||
<string>--</string> | ||
</dict> | ||
<dict> | ||
<key>name</key> | ||
<string>TM_COMMENT_START_2</string> | ||
<key>value</key> | ||
<string>/*</string> | ||
</dict> | ||
<dict> | ||
<key>name</key> | ||
<string>TM_COMMENT_END_2</string> | ||
<key>value</key> | ||
<string>*/</string> | ||
</dict> | ||
</array> | ||
</dict> | ||
</dict> | ||
</plist> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# [PackageDev] target_format: plist, ext: tmPreferences | ||
name: Indent | ||
scope: source.sql | ||
settings: | ||
increaseIndentPattern: >- | ||
(?ix)^( | ||
(\s|,)* \b( | ||
select|from|(group|connect|order|pivot|having)\s+by| | ||
case (?! .*\b(end)\b) | ||
)\b .* | ||
| | ||
.*\(\s* | ||
)$ | ||
decreaseIndentPattern: >- | ||
(?ix)^( | ||
\s* \b( | ||
select|from|(group|connect|order|pivot|having)\s+by| | ||
end | ||
)\b .* | ||
| | ||
\s* \) .* | ||
)$ | ||
bracketIndentNextLinePattern: >- | ||
(?ix)^\s* \b( | ||
when|then|else | ||
)\b \s*$ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>name</key> | ||
<string>Indent</string> | ||
<key>scope</key> | ||
<string>source.sql</string> | ||
<key>settings</key> | ||
<dict> | ||
<key>bracketIndentNextLinePattern</key> | ||
<string>(?ix)^\s* \b( | ||
when|then|else | ||
)\b \s*$</string> | ||
<key>decreaseIndentPattern</key> | ||
<string>(?ix)^( | ||
\s* \b( | ||
select|from|connect\s+by| | ||
end | ||
)\b .* | ||
| | ||
\s* \) .* | ||
)$</string> | ||
<key>increaseIndentPattern</key> | ||
<string>(?ix)^( | ||
(\s|,)* \b( | ||
select|from|connect\s+by| | ||
case (?! .*\b(end)\b) | ||
)\b .* | ||
| | ||
.*\(\s* | ||
)$</string> | ||
</dict> | ||
</dict> | ||
</plist> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# [PackageDev] target_format: plist, ext: tmPreferences | ||
name: Symbol List | ||
scope: >- | ||
source.sql entity.name.subquery | ||
settings: | ||
showInSymbolList: '1' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>name</key> | ||
<string>Symbol List</string> | ||
<key>scope</key> | ||
<string>source.sql entity.name.subquery</string> | ||
<key>settings</key> | ||
<dict> | ||
<key>showInSymbolList</key> | ||
<string>1</string> | ||
</dict> | ||
</dict> | ||
</plist> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
from YAMLMacros.lib.syntax import meta, expect, pop_on, stack | ||
|
||
def meta_set(scope): | ||
return [ | ||
{ 'meta_scope': scope }, | ||
{ 'clear_scopes': 1 }, | ||
{ 'match': r'', 'pop': True }, | ||
] | ||
|
||
def expect_keyword(match, scope="keyword.other.sql"): | ||
return expect(word(match), scope) | ||
|
||
def expect_identifier(scope): | ||
return [ | ||
{ 'match': r'{{unquoted_identifier}}', 'scope': scope, 'pop': True }, | ||
{ | ||
'match': r'(")([^"]+)(")', | ||
'scope': 'string.quoted.double.sql', | ||
'captures': { | ||
'1': 'punctuation.definition.string.begin.sql', | ||
'2': scope, | ||
'3': 'punctuation.definition.string.end.sql', | ||
}, | ||
'pop': True, | ||
}, | ||
|
||
{ 'match': r'(?=\S)', 'pop': True }, | ||
] | ||
|
||
def expect_in_parens(contents): | ||
return [ | ||
{ | ||
'match': r'\(', | ||
'scope': 'punctuation.section.group.begin.sql', | ||
'set': [ | ||
expect(r'\)', 'punctuation.section.group.end.sql'), | ||
contents, | ||
], | ||
}, | ||
{ 'match': r'(?=\S)', 'pop': True }, | ||
] | ||
|
||
def end(keyword=None): | ||
if bool(keyword): | ||
next_context = expect_keyword(keyword, 'keyword.control.sql') | ||
else: | ||
next_context = expect_identifier('variable.other.label.sql') | ||
|
||
return { | ||
'match': word('END'), | ||
'scope': 'keyword.control.sql', | ||
'set': next_context, | ||
} | ||
|
||
def word(match): | ||
return r'(?i)\b(?:%s)\b' % match | ||
|
||
def word_ahead(match): | ||
return r'(?i)\b(?=(?:%s)\b)' % match | ||
|
||
def empty_context(*args): | ||
return [ { 'match':'', 'pop': True } ] | ||
|
||
def all(*contexts): | ||
return [ | ||
{ 'include': context } for context in contexts | ||
] | ||
|
||
def heredoc(start, end): | ||
return { | ||
'match': r"(?i)q\'%s" % start, | ||
'scope': 'punctuation.definition.string.begin.sql', | ||
'set': [ | ||
{ 'meta_include_prototype': False }, | ||
{ 'meta_scope': 'string.quoted.heredoc.sql' }, | ||
{ | ||
'match': r"%s\'" % end, | ||
'scope': 'punctuation.definition.string.end.sql', | ||
'pop': True, | ||
}, | ||
], | ||
} |
Oops, something went wrong.