Skip to content

Commit

Permalink
More features & fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
thom committed Aug 24, 2017
1 parent e3eda5d commit 470f3a8
Show file tree
Hide file tree
Showing 6 changed files with 468 additions and 323 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Sublime Oracle can be installed via [Package Control](https://packagecontrol.io/

- Supports Oracle-specific constructs like `pivot` clauses, quoted identifiers, and factored subqueries.
- Detailed meta scopes for scripting and for the Expand Selection to Scope command.
- Factored subqueries appear in the symbol list.

## Current Limitations

Expand Down
50 changes: 47 additions & 3 deletions syntaxes/macros.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
from YAMLMacros.lib.syntax import meta, expect, pop_on, stack
from YAMLMacros.lib.syntax import meta, stack

def expect(expr, scope, set_context=None):
ret = [
{ "match": expr, "scope": scope },
# { "match": r'(?=\S)', "pop": True },
pop_unless(expr)
]

if set_context:
ret[0]['set'] = set_context
else:
ret[0]['pop'] = True

return ret

def pop_on(expr):
return {
"match": r'(?=\s*(?:%s))' % expr,
"pop": True
}

def pop_unless(expr):
return {
"match": r'(?=\s*(?!%s)\S)' % expr,
"pop": True
}

def meta_set(scope):
return [
Expand All @@ -24,7 +50,7 @@ def expect_identifier(scope):
'pop': True,
},

{ 'match': r'(?=\S)', 'pop': True },
pop_unless(r'{{general_identifier}}'),
]

def expect_in_parens(contents):
Expand Down Expand Up @@ -79,4 +105,22 @@ def heredoc(start, end):
'pop': True,
},
],
}
}

def list_of(context):
return [{
'match': r'',
'set': [
[
{
'match': ',',
'scope': 'punctuation.separator.comma.sql',
'push': context,
},
{
'include': 'else-pop',
}
],
context,
]
}]
Loading

0 comments on commit 470f3a8

Please sign in to comment.