diff --git a/PHP/PHP Source.sublime-syntax b/PHP/PHP Source.sublime-syntax index 0257bb859b..b9a108ed17 100644 --- a/PHP/PHP Source.sublime-syntax +++ b/PHP/PHP Source.sublime-syntax @@ -6,23 +6,14 @@ scope: source.php hidden: true version: 2 +extends: Packages/SQL/SQL String Indicator.sublime-syntax + variables: guarded_identifier: (?!{{reserved}}){{identifier}} identifier: '{{identifier_start}}[[:alnum:]_]*' identifier_start: '[[:alpha:]_]' regex_modifier: '[eimsuxADJSUX]*' - sql_indicator: |- - (?x: \s* (?: - # dml statements - SELECT | INSERT | REPLACE | DELETE | TRUNCATE | UPDATE | MERGE\s+INTO - # ddl statements - | ADD | ALTER | CREATE | DROP - # conditional - | IF \s+ (?: NOT \s+ )? EXISTS - # declaration - | DECLARE | WITH | BEGIN - ) \s ) # A pattern which terminates an incomplete expression at any point. # `\?>` is for fixing one-liner ( https://github.com/sublimehq/Packages/issues/1545 ) diff --git a/Python/Python.sublime-syntax b/Python/Python.sublime-syntax index 3515214b88..4865532cf3 100644 --- a/Python/Python.sublime-syntax +++ b/Python/Python.sublime-syntax @@ -4,6 +4,8 @@ name: Python scope: source.python version: 2 +extends: Packages/SQL/SQL String Indicator.sublime-syntax + file_extensions: - py - py3 @@ -60,18 +62,6 @@ variables: # Prefer ranged quantifiers over python interpolation in raw f-strings fstring_regexp_interpolation_begin: '\{(?!\d+(?:,\d*)?\})' - sql_indicator: |- - (?x: \s* (?: - # dml statements - SELECT | INSERT | REPLACE | DELETE | TRUNCATE | UPDATE | MERGE\s+INTO - # ddl statements - | ADD | ALTER | CREATE | DROP - # conditional - | IF \s+ (?: NOT \s+ )? EXISTS - # declaration - | DECLARE | WITH | BEGIN - ) \s ) - builtin_exceptions: |- (?x: ArithmeticError diff --git a/SQL/SQL String Indicator.sublime-syntax b/SQL/SQL String Indicator.sublime-syntax new file mode 100644 index 0000000000..3889a5b957 --- /dev/null +++ b/SQL/SQL String Indicator.sublime-syntax @@ -0,0 +1,22 @@ +%YAML 1.2 +--- +# See http://www.sublimetext.com/docs/syntax.html +scope: source.sql.string +version: 2 +hidden: true +variables: + sql_indicator: |- + (?x: \s* (?: + # dml statements + SELECT | INSERT | REPLACE | DELETE | TRUNCATE | UPDATE | MERGE\s+INTO + # ddl statements + | ADD | ALTER | CREATE | DROP + # conditional + | IF \s+ (?: NOT \s+ )? EXISTS + # declaration + | DECLARE | WITH | BEGIN + ) \s ) + +contexts: + main: + - meta_append: true