diff --git a/grammars/python.cson b/grammars/python.cson index dc84094..39318ef 100644 --- a/grammars/python.cson +++ b/grammars/python.cson @@ -1643,7 +1643,7 @@ 'name': 'string.quoted.double.block.python' 'patterns': [ { - 'begin': '(?=\\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|WITH))' + 'begin': '(?=\\s*(SELECT|INSERT|UPDATE|DELETE(?! \/)|CREATE|REPLACE|ALTER|WITH))' 'name': 'meta.embedded.sql' 'end': '(?=\\s*""")' 'patterns': [ @@ -1655,7 +1655,7 @@ ] } { - 'begin': '(")(?=\\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|WITH))' + 'begin': '(")(?=\\s*(SELECT|INSERT|UPDATE|DELETE(?! \/)|CREATE|REPLACE|ALTER|WITH))' 'beginCaptures': '1': 'name': 'punctuation.definition.string.begin.python' @@ -2214,7 +2214,7 @@ 'name': 'string.quoted.single.block.python' 'patterns': [ { - 'begin': '(?=\\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|WITH))' + 'begin': '(?=\\s*(SELECT|INSERT|UPDATE|DELETE(?! \/)|CREATE|REPLACE|ALTER|WITH))' 'end': '(?=\\s*\'\'\')' 'name': 'meta.embedded.sql' 'patterns': [ @@ -2226,7 +2226,7 @@ ] } { - 'begin': '(\')(?=\\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|WITH))' + 'begin': '(\')(?=\\s*(SELECT|INSERT|UPDATE|DELETE(?! \/)|CREATE|REPLACE|ALTER|WITH))' 'beginCaptures': '1': 'name': 'punctuation.definition.string.begin.python' diff --git a/spec/python-spec.coffee b/spec/python-spec.coffee index c1851d0..423f8c1 100644 --- a/spec/python-spec.coffee +++ b/spec/python-spec.coffee @@ -750,3 +750,10 @@ describe "Python grammar", -> expect(tokens[13]).toEqual value: ')', scopes: ['source.python', 'string.quoted.double.single-line.sql.python', 'meta.embedded.sql', 'punctuation.definition.section.bracket.round.end.sql'] expect(tokens[15]).toEqual value: '"', scopes: ['source.python', 'string.quoted.double.single-line.sql.python', 'punctuation.definition.string.end.python'] expect(tokens[17]).toEqual value: '%', scopes: ['source.python', 'keyword.operator.arithmetic.python'] + + it "recognizes DELETE as an HTTP method", -> + {tokens} = grammar.tokenizeLine('"DELETE /api/v1/endpoint"') + + expect(tokens[0]).toEqual value: '"', scopes: ['source.python', 'string.quoted.double.single-line.python', 'punctuation.definition.string.begin.python'] + expect(tokens[1]).toEqual value: 'DELETE /api/v1/endpoint', scopes: ['source.python', 'string.quoted.double.single-line.python'] + expect(tokens[2]).toEqual value: '"', scopes: ['source.python', 'string.quoted.double.single-line.python', 'punctuation.definition.string.end.python']